[Grace-core] On Gradual Typing

Andrew P Black andrew.p.black at gmail.com
Thu Jul 18 15:51:10 PDT 2013


On 18 Jul 2013, at 14:40 , Kim Bruce wrote:

>> 2    for (1..5) { i -> sum := sum + i }
>> I am clearly concerned with the actual values I am iterating over.
>> What about if I simply want to repeat something?
>> 1    for (1..5) { print "****************" }
>> Firstly, is this type-correct? It seems that it cannot be, when there
>> is no overarching Block type. Secondly - ignoring types - is it even
>> semantically valid at runtime? Can I provide a block with excess
>> arguments? People have been habitually writing code with both forms

I haven't.  In fact, in the GUinit code, I suggested defining timesRepeat as a method on numbers, as in 

	r.timesRepeat { doSomething} 

I agree with Kim that we should not use the same method for the two cases.

In teaching, providing the wrong number of arguments is a common error.  So we should design the language to give as many warnings about this as possible.
Perhaps this was the reason that Kim was opposed to allowing overloading by arity?  

	Andrew



More information about the Grace-core mailing list