Re: This does not jive
- Posted by ne1uno Sep 02, 2012
- 1975 views
junk={WndMain,1}&rect&{5,5} drawRectangle(junk[1],junk[2],junk[3],junk[4],junk[5],junk[6],junk[7],junk[8])
This would seem fix the problem but a lot of work.
junk[1..8] is a single sequence with 8 elements. If you pass that as a parameter to a routine, it is a single argument. Yes, you'll need to split it out, separated by commas, if you want the elements to be treated as separate parameters.
There have been other occasions when a parameter list in a sequence had to be split up in this way. Perhaps a new syntax could indicate that the sequence should be desequenced into the parameters? Thinking rather crudely that the reverse of sequence would be }{ the format:
drawRoundRect( }junk{ )
would have the same effect as:
call_proc(routine_id("drawRoundRect"),junk)
although possibly more efficiently. I am not going to raise a feature ticket because it is just a silly thought and there would probably be a much better syntax anyway.
flipping the braces is an interesting idea, but probably a nightmare for parsing and syntax syntax coloring. even if solvable by euphoria devs it could prove a nightmare for 3rd party tools.
there was talk a few months ago about using '@' with routine ID. this would mostly be used by a few of the larger library creators. though once in use, more general usage might be found.
a better use of '@' would be for unpacking sequences. Python has a similar syntax using '*' to unpack arrays. maybe '*' would work as well if there would be no conflict with present and future struct syntax.