I confess that I've been wanting a shortcut for creating arrays for a long
time and have even considered submitting this feature request myself.  This
is not something difficult to implement, but my resistance to doing this
has more to do with the fact that it introduces new syntax.

Using square brackets for purposes other than message invocations has
always been one of those "back pocket" syntax elements that have been held
in reserve until a use that was good enough to say "yes, this is really
what I want to use this for.".  Other uses for brackets I've considered in
the past have been multi-line literals and creating variable references.
 This has always been a balancing act.  You don't want to use this on
something trivial, but at the same time, you don't want to be so resistant
to using it that you have effectively removed from being a possibility.
 Curly braces have been in this category for a VERY long time.  We need to
consider if "syntactic" sugar is important enough use for this syntactic
concept.

Admittedly, array objects are very important in ooRexx.  They pop up in
lots of situations as return values and also as arguments to both
instructions and methods. Are they important enough that they get the
special syntax rather than some other object type?  That needs to be
considered.  There are a few obvious places where this might make a lot of
sense.  Jon shows the obvious assignment case, but this would be fairly
useful for things like DO OVER

do name over ["Mike", "Jon", "David"]

looks nicer than

do name over .array~of("Mike", "Jon", "David")

and feels a bit more natural and integrate.

Being able to create arrays without a lot of extra syntax would make
something like OF methods for map collections workable.  For example,

locs = .directory~of(["Rick", "USA"], ["Mike", "UK"])

where you are using the array syntax to create index/value pairs for
insertion into the directory.

Anyway, I've laid out the issues as I see them.  I think this is something
that needs a bit of discussion before a decision is made because of the
syntax issues.  The 5.0 release I've been working on would be a good place
to introduce this concept.

Rick

Rick



---------- Forwarded message ----------
From: Jon Wolfers <[email protected]>
Date: Thu, Sep 18, 2014 at 5:08 AM
Subject: [oorexx:feature-requests] #613 Syntactic sugar for array creation
To: Ticket 613 <[email protected]>





---

** [feature-requests:#613] Syntactic sugar for array creation**

**Status:** unread
**Milestone:** None
**Created:** Thu Sep 18, 2014 09:08 AM UTC by Jon Wolfers
**Last Updated:** Thu Sep 18, 2014 09:08 AM UTC
**Owner:** nobody

Just an idea.

How about a bit of syntactic sugar such that

~~~~~~~~~~
variable = ['First','Second','Third']
~~~~~~~~~~
is equivalent to

~~~~~~~~~~
variable = .array~of('First','Second','Third')
~~~~~~~~~~

It could also be allowed for cases like

~~~~~~~~~~
do variable over ['First','Second','Third']
   ...
end
~~~~~~~~~~



I have seen this in other languages and think it is quite neat

Jon


---

Sent from sourceforge.net because you indicated interest in <
https://sourceforge.net/p/oorexx/feature-requests/613/>

To unsubscribe from further messages, please visit <
https://sourceforge.net/auth/subscriptions/>
------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to