2 ms·
> Most dynamic languages will let you pass in any number of parameters regardless of its definition and you may not even notice. Python will throw an error. Ru
by dozzie 10y ago
> Most dynamic languages will let you pass in any number of parameters regardless of its definition and you may not even notice.
Python will throw an error. Ruby will throw an error. Tcl will throw an error.
Erlang will throw an error. I believe most of the Lisps will throw an error.
What was it about "most dynamic languages"?
- BinaryIdiot 10y ago> What was it about "most dynamic languages"? I should have changed my text to not say "regardless of definition" because you can do that in Python, Ruby, PHP, JavaScript, etc. Python and Ruby support it through (star)args or default parameters JavaScript supports it regardless PHP supports it regardless We can argue semantics or the fact that some of those types of errors can be caught with some subset of dynamic languages but I don't think that's useful. My only point was when comparing a dynamic language with a static language I find variable function parameters to be one of the bigger issues over type coercion. But that's just, like, my opinion.
- deleted 10y ago[deleted]
- kbp 10y agoThose aren't particular to dynamic languages, though. You can add C, C++, Java, and C# to your list of languages that support it. Being able to explicitly make a parameter optional, or to have a 0-or-more rest argument is different from how function application works in Javascript or Perl because you have explicitly made that part of your function's signature, and the language still checks calls against that signature.