More Wishlist Things

new topic     » topic index » view thread      » older message » newer message

G'day all

While we're talking about wishlist items, I'd like to see some
support for a shorthand notation in Euphoria, something like the
#define used by C/C++. It would be nice if something like the
following:

<longhand>
for i = 1 to length(mainseq)
   mainseq[i][21] = mainseq[i][5] + mainseq[i][15]
   mainseq[i][22] = mainseq[i][8] - mainseq[i][9]
   mainseq[i][23] = (mainseq[i][12] / mainseq[i][13]) + mainseq[i][5]
   <lots more of the same>
   if i != 1
      mainseq[i][54] = mainseq[i-1][7] + 2
   else
      mainseq[i][54] = 0
   end if
end for
</longhand>

could be cut down to something like:

<shorthand>
for i = 1 to length(mainseq)
   with mainseq[i]
      [21] = [5] + [15]
      [22] = [8] - [9]
      [23] = ([12] / [13]) + [5]
      < lots more of the same>
      if i != 1
         [54] = mainseq[i-1][7] + 2
      else
         [54] = 0
      end if
   end with
end for
</shorthand>

I know this could be done with a preprocessor, and I also know
that the "with..end with" syntax has been linked with namespaces,
but it still would be a nice thing to have, whatever the syntax.

Regards
Tony

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu