Re: Dylan stuff

Bruce Hoult <[email protected]>
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CAMU+EkyB=ouJU4uwewxVm+25bND+VoX99dnjoS=BV=cjK0MxAw@mail.gmail.com>
I agree.

My suggestion, if I was to start again, would be for the rule

http://opendylan.org/books/drm/Phrase_Grammar#XREF-2115

( parametersopt ) => variable ;

to have "variable" changed to "type". The return value for a function
with a single value seldom needs naming. It's implicit from the name
of the function. It's pointless having to name it "res" just so you
can add a type. This is one of the most common errors people new to
Dylan make[1] as they're used to just specifying a type for the return
value.

When you have multiple return values — a feature few other languages
have — it's much more useful to name the return values.

Unfortunately, this is incompatible with all existing code.


Another option would be to make it possible to pass
required-parameters to functions by name and have the compiler reorder
them (if necessary). This is useful in general, especially with
functions with many arguments, but in particular it would provide an
(optonal) use for return value names.

[1] the other one of course is local bindings shadowing methods,
especially accessor methods.

On Fri, Jan 18, 2013 at 12:52 AM, Hannes Mehnert <[email protected]> wrote:
> Hi,
>
> On 17/01/2013 09:25, mikel evins wrote:
>>
>> On Jan 17, 2013, at 2:22 AM, Bruce Mitchener wrote:
>>
>>> The main thing missing there is having names for the return values
>>> (which have no meaning and are largely for documentation value).
>>
>> It would be easy enough to do that, too:
>>
>> (define sealed method foo ((x <fixnum>)(y <fixnum>)) => ((answer
>> <fixnum>) (success? <boolean>) #rest more-parts) (begin
>> (do-stuff-to-x) ...))
>>
>> The only issue, really, is whether that's better or worse. In favor,
>> it adds more information about the programmer's intentions. Opposed,
>> it makes things quite a bit more verbose, and the additional names
>> have no functional use.
>
> my experience is that it is hard to explain/justify to other programmers
> why there are unused names for return values.
>
> Also, when writing code myself I most of the time use "res" or "result"
> as return names, which is pretty useless for documentation purposes.
>
> So, overall I wouldn't bother with names for return values.
>
>
> Cheers,
>
> Hannes
> _______________________________________________
> hackers mailing list
> [email protected]
> https://lists.opendylan.org/mailman/listinfo/hackers
_______________________________________________
hackers mailing list
[email protected]
https://lists.opendylan.org/mailman/listinfo/hackers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.