Re: Dylan stuff

Carl Gay <[email protected]>
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CALekcH0JGr9b8D1eygM412nT7V5y9CtRo9nKa-M0t497z9=otw@mail.gmail.com>
On Thu, Jan 17, 2013 at 6: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
>
>
I do want to have named return values at least for "define generic", and if
that has it it would be weird for "define method" not to have it as well.

define open generic find-resource
    (router :: <abstract-router>, url :: <object>)
 => (resource :: <abstract-resource>, prefix :: <list>, suffix :: <list>);

Remove the return value names and this code is no longer
semi-self-documenting; it's just mysterious.  The names are useful for
tooling.

-Carl

_______________________________________________
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.