Do you work as software developer in a company? I guess not . (Also I don't but I made some internships): If you talk like that in a company you're fired immediately I guess .quicko safety rant
I personally don't like all that extra safety. I say only have safety in debug mode complete with error messages. If code is coded right, safety isn't needed. Only need safety when you are dealing with player input (text commands and what not).
Safety is just extra fluff that provides false positives.
end quicko safety rant
Code is always wrong at first. There is no genius that codes bugless code. Thus safety just speeds up the production of really bugless code since you can make less and only less serious bugs.
You even do not need a typed language with this logic. Datatypes are just there to protect you from errors . So back to assembler .
But enough of that, I know what you wanna say. And also I sometimes wanna do such hacks . I wish we still had pointers...
Your example does not work. Neither the first, nor the second. Since ++ uses java / C semantics. And those semantics say that the operand must be a correct LValue. Method invocations are no correct LValues, so you should get an error here.
Be sure, my inlining will be that clever .Other questions about how you intend to finish inline that I can ask later relate to when it copies variables into other variables and when it doesn't. For example, it should only have to copy a variable if it does a write to that variable somewhere in the inlined method. Variables that are only read should not need to be copied ; ).
foreach syntax:
This one. As it is java syntax.for (type var: col)
I am not quite sure how it will work. Probably with an Iterator. Your datastructure must provide a getIterator() method that returns and properly initializes an iterator (here, it should be set on your "first" element). The iterator has then the next and hasNext methods. The iterator will be deleted after the loop has finished.