My nano-cent contribution is that this ('with index i item v over x')
seems to be a much more Rexx-ish syntax than the previous proposals.
-Chip-
On 10/13/2014 8:46 AM, Rick McGuire wrote:
> I am most definitely not trying to redefine how OVER works and really
> can't for compatibility reasons. I'm trying to address the situations
> where iteration over a collection where both the item and index are
> significant and having the loop instruction handle a lot of the
> details to prevent errors. Supplier was supposed to be that iterator
> mechanism, but by itself, is proving to be hard to use and error prone.
>
> Right now, I'm finding I'm not comfortable about how the parsing of
> this instruction has to proceed. The validity of the list of
> variables cannot be determined until you encounter the WITH keyword.
> I think this can work, but perhaps we should try some other
> approaches. Maybe something completely keyword based?
>
> loop with index i item v over x
>
> The with keyword indicates you have multiple variables, the item and
> index keywords indicate which variable gets which value, removing the
> argument about what is the appropriate order to specify these... and
> one or the other variable can be optional, depending what you need.
> The OVER keyword can still be used, but know the loop can examine the
> result and decide what the most appropriate iteration means should be
> for the type of object it receives.
>
> Rick
>
> On Mon, Oct 13, 2014 at 8:13 AM, Brandon Cherry
> <[email protected] <mailto:[email protected]>> wrote:
>
> On 10/11/2014 7:22 AM, Rick McGuire wrote:
> > Right now, I'm thinking I quite like Walter's suggestion of using WITH
> > as the keyword. I think it should be possible to also make the second
> > variable optional, which would make is similar to DO OVER, but not
> > necessarily identical, because the single variable will either be always
> > an index or always a value, where DO OVER assignments are determined by
> > what the OVER object returns for MAKEARRAY.
> >
> > Rick
>
> I would like "with" to be reserved for something like a resource that
> needs to be setup and torn down. That is how this instruction is
> currently used in other languages. Using it for what is proposed
> will be
> just another quirk to ooRexx and make it harder for people who
> might be
> switching from another language.
>
> Here are some examples:
>
> -- file is closed
> do file with handle
> -- file is opened
> char = handle~charin(1)
> end
> -- file is closed
>
> Exact syntax I am not sure of but the basic idea being that "file"
> would
> be some arguments defining file path and open type. The "handle" being
> the variable you can reference in the do block. This could also make
> working with semaphores, sockets, and who knows what else easier, too.
>
> Have you given some thought to just defining an iterator class and
> making the "over" instruction only handle iterators? I have generally
> assumed that supplier is suppose to be the closest thing in ooRexx
> that
> is similar to that. Something to think about since you are wanting to
> redefine how "over" works.
> --
> Brandon Cherry
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS
> Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://p.sf.net/sfu/Zoho
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> <mailto:[email protected]>
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
>
>
>
> ------------------------------------------------------------------------------
> Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
> Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
> Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
> Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
> http://p.sf.net/sfu/Zoho
>
>
>
> _______________________________________________
> Oorexx-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/oorexx-devel
>
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel