#What was the conclusion of the “optional arguments” discussion?

1 messages · Page 1 of 1 (latest)

novel hazel
cyan kraken
#

No one has done the R&D work to figure out the details

#

Seems the community has largely lost interest

crude saffron
#

I‘d sponsor a welcome design a bit as I really like it but cannot even find time to update glacier

novel hazel
high abyss
#

I'm team @white thicket on this one. This simple function + complex function + builder if you really need it is the way to go

crude saffron
#

to keep it positive: For custom types: To me the direct types signify much clearer what’s going on. I have tried the above with flutter-like types and it is very verbose. The strangeness budget is very low compared to other convenience features that got added. For functions this can very used to extend the stdlib for instance by supplying other ranfom generators or having list.range that reads and works unambiguously and can be customized out of the box.

white thicket
#

its been a while since we had this bikeshed

high furnace
crude saffron
#

its been a while since we had this bikeshed
just imagine how aggressive this had sounded if people said that about use to its apologets?

anyway, partisanship here won't help with the negative vibe, nor downplaying that others seem to find it useful.

high furnace
#

the problem isn't that people want it, it's that it's never gotten past the "wouldn't it be nice" stage and the most that happens is a conversation about the broad outlines of the proposal

outer raft
#

i found the proposal for default arguments for constructors extremely nice, even without default arguments for functions i think that's something worth having... will have to read the rest of that discussion to figure out why that wasn't adopted yet

cyan kraken
#

We're not going to have it for only constructor functions and not user defined functions

#

In Gleam they are the same

outer raft
#

oh, i didn't know that ^^;

#

can't say i've missed optional arguments much for functions, it's just a pain for large nested types, but that could possibly also be alleviated by LSP

#

i do however end up writing most recursive functions in the form of:

pub fn do_thing(arg) {
  do_thing_rec(arg, [])
}

fn do_thing_rec(arg, acc) {
  ...
}

which i think is pretty standard in erlang as well