jastrachan | 17 Nov 09:35 2004
Picon

Re: Keyword: "any" over "def"

On 17 Nov 2004, at 08:13, robert kuzelj wrote:
> Guillaume Laforge wrote:
>> Alan Green wrote:
>>> any createMailLabel(any person, any address)  {
>>>     any lines = [person.fullName, address.firstLine, address.suburb]
>>>     any i = 0
>>>     any result = ""
>>>     for (line in lines) {
>>>         result += i + ", " + line
>>>         i++
>>>     }
>>>     return result
>>> }
>> I think in this example we can omit the "any"s in the parameters' 
>> definition. I guess the following reads better:
>> String createMailLabel(person, address) {
>>      List lines = [person.fullName, address.firstLine, address.suburb]
>>      int i = 0
>>      String result = ""
>>      for (line in lines) {
>>          result += i + ", " + line
>>          i++
>>      }
>>      return result
>> }
>
> great example guillaume and alan. this is exactly what i expect a
> optionally typed dynamic language to allow.
>
> 1) get your code running( dont waste time on types)
> 3) refine as it suits you

Agreed!

> another things you should do:
> - make typedeclaration mandatory everywhere (param lists)

This is possible.

> - make ; mandatory

I see no real use of this. Now that we've fixed the compiler 
ambiguities, you'll get good compiler errors whether you use them or 
not. If you like them, use them. Personally I find them a noisy 
distraction which add no value. Its bizarre but dropping them makes 
code much more legible.

> - get rid of optionals (parens)

Optional parens for statements are the top of the list of things that 
may go; for now they are still there and supported, only for top level 
statements. If it simplifies the grammar we could consider dropping 
them.

> - get rid of the "we are a bit whitespace sensitive"

We're not. Its just newlines are only allowed at certain points in the 
grammar and adding newlines in the wrong places should, once we've 
fixed the grammar, cause the correct compiler errors to avoid users 
getting themselves confused. This is no different from JavaScript, 
Ruby, Python and many other languages.

> <sigh> but i guess these are hopeless hopes...

:). Not at all. Everyone's views help. Though unfortunately we're not 
gonna please everyone.

James
-------
http://radio.weblogs.com/0112098/


Gmane