I would welcome Fortran-style end- and loop-labeling. Emacs' F90 mode inserts these labels for you automatically on the corresponding end statements if you had previously included them on the opening do, function, subroutine, module, etc., statement. The ability to concisely, clearly, and efficiently exit from a deeply nested loop structure is very powerful and useful.
--Peter On Monday, May 12, 2014 6:44:18 AM UTC-7, Ivar Nesje wrote: > > It would be great if an IDE could add comments after end if the opening of > the block can't fit on the same screen. A code formatter should definitely > implement something like that. > > A syntax would be nice, because Julia could issue warnings/errors when the > two come out of sync. It could also be helpful to give better error > messages for missing/extra `end` statements. The only objection I can see > is that it makes the language and implementation more complex, and it will > increase the time it takes to learn Julia. That is a high price for a > feature that is rarely used. > > Ivar > > > kl. 15:18:06 UTC+2 mandag 12. mai 2014 skrev Simon Danisch følgende: >> >> My philosophy is to have a language as simple and concise as possible. >> Every optional or alternative term makes it a little harder to read code >> written by another person. >> Like code folding, hiding of comments, etc, this should be really rather >> an IDE feature, so that one can turn it on and off. >> >> >> Am Freitag, 9. Mai 2014 16:07:17 UTC+2 schrieb Rayan Ivaturi: >>> >>> How about having end as a function to make the code look clean when >>> there are many blocks and 'end'up with a series of continuous end >>> statements? >>> >>> Consider the following piece of code for looping to create a >>> term-frequency dictionary (quoted from >>> http://randyzwitch.com/julia-language-beginners/) >>> >>> term_freq=Dict{String, Int64}() >>> for word in english_dictionary >>> for url in url_list >>> if search(line, word) != (0:-1) >>> term_freq[word]=get(term_freq,word,0)+1 >>> end >>> end >>> end >>> >>> If this can be written as the below snippet by making end as function >>> with argument as number, which matches the 2 for loops and one if >>> statement? Might look more clean. >>> >>> term_freq=Dict{String, Int64}() >>> for word in english_dictionary >>> for url in url_list >>> if search(line, word) != (0:-1) >>> term_freq[word]=get(term_freq,word,0)+1 >>> end(3) >>> >>> of course, this particular use case applies only when there is a >>> continuous series of end statements only... >>> >>