November 28, 2003
davepermen wrote:

> i always threat all warnings as errors and correct them in a way both me and the
> compiler are happy. a warning means he is not sure about something is fine.
> explain him in a nice way that it is: by solving his issue.

So do I. I hate having warnings in my code, as I have stated in my post.

I didn't want to imply that catching/disabling warnings regularly is a good thing. I merely found the concept of static exceptions interesting.

And I still do :). If you think this through to the end you end up replacing simple templates with generic compile-time functions that generate classes. How cool is that?!

Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...

Hauke

November 29, 2003
Hauke Duden wrote:

> davepermen wrote:
>
>> i always threat all warnings as errors and correct them in a way both me and the
>> compiler are happy. a warning means he is not sure about something is fine.
>> explain him in a nice way that it is: by solving his issue.
>
>
> So do I. I hate having warnings in my code, as I have stated in my post.
>
> I didn't want to imply that catching/disabling warnings regularly is a good thing. I merely found the concept of static exceptions interesting.
>
> And I still do :). If you think this through to the end you end up replacing simple templates with generic compile-time functions that generate classes. How cool is that?!
>
> Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...
>
> Hauke


Parhaps if instead of warnings, if user-defined-error (exceptions) where caught, then static exceptions could have some real benefits.  Ie instead of warnings catch compile time errors.  I say, a bug caught at compile time saves nine.  Although, I haven't really thought about how it would look (or even if it's feasible -> I'll leave that to others).  It also leads into that "compile time function" thing I suggested ;) which no-body else seemed to like :(

-Anderson

December 01, 2003
In article <bq8ml5$df9$1@digitaldaemon.com>, Hauke Duden wrote:
> I didn't want to imply that catching/disabling warnings regularly is a good thing. I merely found the concept of static exceptions interesting.
> 
> And I still do :). If you think this through to the end you end up replacing simple templates with generic compile-time functions that generate classes. How cool is that?!
> 
> Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...

Me too.

There are plans underway for making compile time functions in C++ -- http://www.vandevoorde.com/Daveed/News/Archives/000014.html -- and Haskell -- http://research.microsoft.com/Users/simonpj/papers/meta-haskell/ -- but these projects still seem very experimental.

-Antti

December 01, 2003
Hauke Duden wrote:

> So why not have static exceptions? I.e. the ability to "catch" warnings that occur at compile time and prevent them from being printed? The syntax would be a lot cleaner than littering the code with pragma's and at the same time it would be explicitly obvious that you know about the warning and it can be safely ignored.

I think what you really want here is compile-time code execution. Somehting similar to Common Lisp's eval-when. (more information at
http://www-2.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/speope_eval-when.html )

However, D is a statically compiled langiage and doesn't support compiler-time execution. Therefore youre static (but conditional) code would have to be executed at run time. Not a good tradeoff compared to actually finixing the bug that cuased the warning in the first place.

Elias

December 01, 2003
Hauke Duden wrote:

> Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...

Yes, Common Lisp has all this. Like I mentioned in the previous pos, there is a construct called eval-when, which allows you to run certain code when the file is compiled, loaded into the VM, or when it's evaluated. The example in the documentation (http://www-2.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/speope_eval-when.html ) uses this feature to alter the reader (parser) in order to extend the language before the rest of the code is compiled.

Common Lisp also has a completely programmable metamodel for the object system.

Elias

December 01, 2003
Elias Martenson wrote:
> Hauke Duden wrote:
> 
>> Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...
> 
> 
> Yes, Common Lisp has all this. Like I mentioned in the previous pos, there is a construct called eval-when, which allows you to run certain code when the file is compiled, loaded into the VM, or when it's evaluated. The example in the documentation (http://www-2.cs.cmu.edu/Groups/AI/html/hyperspec/HyperSpec/Body/speope_eval-when.html ) uses this feature to alter the reader (parser) in order to extend the language before the rest of the code is compiled.
> 
> Common Lisp also has a completely programmable metamodel for the object system.

Thanks! I'll take a look at it!

Hauke

December 03, 2003
Hauke Duden wrote:

> Is there any language that does this kind of thing? I know something similar could be done with Lua, since in Lua a "class" is really a runtime construct. But are there any compiled languages that have something like compile time class generating functions? I'd be interested in learning about such languages, if they exist...

See compile-time reflection.

http://www.csg.is.titech.ac.jp/~chiba/openc++.html
http://www.csg.is.titech.ac.jp/openjava/

-eye

1 2
Next ›   Last »