4 ms·
That's a lot of extra keywords.
by mariusor 6y ago
That's a lot of extra keywords.
- Jtsummers 6y agoI suspect the bigger point being made by GP is that languages with manual memory management and iterators are not an incompatible concept. Given pjmlp is the commenter I suspect the language he's using is Pascal or another Wirthian language. See also Ada for another example of a language with manual memory management and iterator constructs. It may introduce some extra syntax/keywords though, which could be against what seems to be a minimalist approach (from the sample).
- pjmlp 6y agoCode is read more than written, readability matters.
- tom_mellior 6y agoIf readability matters, there shouldn't be an extra counter variable for the reader to keep in mind. for greeting in greetings do is more readable if nothing interesting is done with the counter itself.
- Jtsummers 6y agoAda does this. Offering both styles: for x of Some_Array loop for i in Some_Array’Range loop Allowing you to do the appropriate thing for your situation.
- pjmlp 6y agoIndeed, I just wrote the version where the counter matters, because it was used as such on the original examples. As a matter of fact, Object Pascal/Delphi uses the for in syntax when it doesn't matter.