For Programmers: Free Programming Magazines  


Home > Archive > Functional > May 2007 > Rest arguments / varargs









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Rest arguments / varargs
David Hopwood

2007-05-06, 7:03 pm

Jon Harrop wrote:
> Neelakantan Krishnaswami wrote:
>
>
> Just pass a list.
>
> With no static typing Lisp has no notion of statically-enforced arity so
> Lisp functions always pass a list of arguments whether that is what you
> really want or not.


rest arguments are not incompatible with static typing. For example Java 1.5
supports them (under the name "varargs"), although not with currying.

rest arguments + static typing + currying are not even incompatible; see
<http://okmij.org/ftp/Haskell/vararg-fn.lhs>, or Haskell's printf module.

Personally, I think that passing a list is clearer in the vast majority of
cases where varargs might have been used, and O'Caml not supporting them is
of no consequence.

--
David Hopwood <david.hopwood@industrial-designers.co.uk>
Jon Harrop

2007-05-06, 7:03 pm

David Hopwood wrote:
> rest arguments are not incompatible with static typing.


Yes. You can just pass a list.

> Personally, I think that passing a list is clearer in the vast majority of
> cases where varargs might have been used,


Absolutely. I don't understand why there is any confusion over this. Lisp is
just passing arguments by list.

> and O'Caml not supporting them is of no consequence.


OCaml supports both statically typed optional and labelled arguments, and
passing a list. So I think it has all avenues covered.

--
Dr Jon D Harrop, Flying Frog Consultancy
The F#.NET Journal
http://www.ffconsultancy.com/produc...journal/?usenet
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com