Block close check

Wolven rma at wolven.net
Sun Dec 10 22:55:27 PST 2006


== Quote from Chris Nicholson-Sauls (ibisbasenji at gmail.com)'s article
> Luís Marques wrote:
> > Better syntaxes could be invented, I just wanted an opinion on the gist
> > idea.
> >
> >
> > Luís
> Personally I do prefer keeping them as comments, as they serve primarily as a
visual cue
> in really long functions/classes/structs for me.  (And I like to keep things
like this
> "green" in my editor. :))  Although, that said, in a scripting language idea I toyed
> around with, I did have this as an option, such as:
> # function doit (Int $i) begin
> #   while ($i > 0) begin
> #     ...do lot of stuff...
> #   end while
> # end doit
> Ordinarily it uses {}'s but I put the begin/end[name] thing in there.  I just
don't think
> it would be very "D like".
> -- Chris Nicholson-Sauls


While it may not be very "D like", it sure makes the code MUCH more readable and
"nicer" looking IMO.  VASTLY better than the meaningless and hideous curly braces.
 Especially when there is a LOT of ...stuff... and nesting going on.  Ideally, I
think it should go one step further, with the compiler automatically putting in
the comments after the End statements. Like this...


# function doit (Int $i) begin
#   while ($i > 0) begin
#     ...do lot of stuff...
#   end while  // ($i > 0)
# end doit  // (Int $i)

Of course, I'm not biased or anything... :)



More information about the Digitalmars-d mailing list