[Grace-core] Parsing ambiguity

James Noble kjx at ecs.vuw.ac.nz
Wed Jul 2 01:15:56 PDT 2014


> 10..100..2

Oh I do like this.  (even if it shows why all spaces shouldn't be mandatory around every operator)

Unfortunately the felicity of writing 10 .. 1 .. -1 probably means that another proposal won't get up:
having the ".." operator go up in cases like 1..10, down in cases like 10..1, and providing 
factory methods like   range(1) upTo(10),   range(10) downTo(1), range(1) upTo(10) by(2) 
for people who want to be more specific.  or careful.  

James

BTW: 

Ruby 1..2 -> 1, 2, 3 
Ruby  1...3 -> 1, 2

Swift 1..2 -> 1,2 
Swift 1...3  -> 1,2,3


On 2/07/2014, at 19:50 pm, Michael Homer <Michael.Homer at ecs.vuw.ac.nz> wrote:

> On Wed, Jul 2, 2014 at 7:40 PM, Timothy Jones <tim at ecs.vuw.ac.nz> wrote:
>> On 02/07, Marco Servetto wrote:
>>> yes, but if Grace is for teaching, we have to be -as bad- as the other
>>> languages, or if possible, as bad as all of them at the same time.
>> 
>> But the argument against consistency with other languages here is that we have
>> one-indexed lists, so it's not even the same behaviour as subscripting in other
>> languages.
> ALGOL, COBOL, Fortran, Lua, PL/I, Smalltalk*, and some modules in some
> Visual Basic programs would like a word with you.
> 
> (Suggestion: indexing should be by opaque arbitrary objects,
> determined by a non-repeating iterable provided at creation time:
> array.new(1..10), array.new(10..100..2). Pascal actually does this
> right.)
> -Michael
> * Of course.
> _______________________________________________
> Grace-core mailing list
> Grace-core at cecs.pdx.edu
> https://mailhost.cecs.pdx.edu/mailman/listinfo/grace-core




More information about the Grace-core mailing list