VoltLang / Volta

Compiler for the Volt Programming Language
151 stars 8 forks source link

Does Volta need foreach_revese? #14

Closed bubnenkoff closed 8 years ago

bubnenkoff commented 8 years ago

I have seen that Volta use foreach_reverse. But it's operator look a little bit ugly. Maybe it's better to replace it with something foreach(i; 99 .. 0 : -1). And could you change semantic of to be able write like:

foreach (element in elements) Or even like Python for (element in elements) Or: for (element in elements.reverse)

Dav1dde commented 8 years ago

We did actually discuss this yesterday on IRC (and before a while back). Some kind of reveresed() will be there at some point, but simply doesn't work yet (no iterators/ranges or similiar). foreach_reverese is gonna stay for now, simply because it is a lot cleaner than doing it manually with a C for.

bubnenkoff commented 8 years ago

I do not think that it's good idea to downgrade languages futures only because you want to be C-compatibility. A lot of people need simple hight level language for hight level task, that do not need to have low-level access. Who need C/C++ may use D, that done a lot of work in this direction. I do not see reasons to cpend time to it. One of thing that I do not like in D -- it become so complex and it's core developers spend a lot of time to low-level stuff.

Dav1dde commented 8 years ago

Did you read what I wrote? Where is there a downgraded 'future'?

bubnenkoff commented 8 years ago

Sorry, look like I misunderstand part: "because it is a lot cleaner than doing it manually with a C for". So there is chance to improving it's later?

Dav1dde commented 8 years ago

Yes. But this needs to be further discussed, Jakob brought up some good points for foreach_reverese, but right now it is not worth removing it anyways.

Wallbraker commented 8 years ago

There are a whole bunch of issues that needs to be investigated with a ranged base reverse. Like for instance the actual instructions that they get lowered down into.

We can reevaluate foreach_reverse at a later time, right now they are here to stay for the foreseeable future.