Re: Check this out for a good laugh
Artem Gr <[email protected]> Thu, 15 Sep 2005 17:45:17 +0400
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
> what are option types in spec#? "T!" thingies? I guess > this scheme, T!, T?, T*, T+ makes the good old T > almost ridiculous, because the others, as far as I get > it, do not distinguish between primitive types and > references. should a language necessarily have that > distinction to be fast? I don't quite get your question, but there is a "null pointer check" performed by some compilers (GCC) to throw the NullPointerException, and one of optimizations they planning is this null pointer check removal, but these optimizations, even if implemented, are limited to some local scope, so having optional types in the language itself might improve the performance. > I mean, is it possible to > design a compiler that is smart enough to retain the > optimal performance? I'm pretty sure it is possible. But language specification often poses some restrictions. For example, C++ compilers seemed to be quite restricted by the specification for some system programming purposes, and in Java there is the memory model specification. > what happens to passing a > parameter to a function? how would I let the compiler > know whether I want it to be passed by value or by > reference? am I asking the right questions? anyone? > Daniel? what do you think? do you have any innovative > ideas on this one? I think M$'s stand on the question > is that the 'value types' are passed by value and the > 'reference types' by reference, where they have > 'struct' making composite value types and 'class' > making composite reference types and in order to pass > a primitive type by reference you use the [out] > keyword. must it all be this much complicated? Modern JIT compilers are said to be good in this kind of things, they will inline the method and there will be no necessity to pass the variable at all. The meaning of the [out] keyword in presense of a JIT compiler is more of a semantical, rather then optimization side, it simply allows the function to modify an outer value without returning it (and without having to treat it as a reference). I think this had to be implemented in .CLR becouse of C++, where this thing is possible with aliases. ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php