this post was submitted on 11 Oct 2023
61 points (94.2% liked)

Programming

17484 readers
175 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 9 points 1 year ago (2 children)

Is it just me or does it feel kinda unclean for it to just support 1 through 9?

[–] [email protected] 10 points 1 year ago (1 children)

tbf positional arguments are already bad enough. Now if you're using over 9 positional args... just take a break, go for a short walk, and maybe you'll come back with a better plan

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago) (1 children)

I mean 4 is probably too many, 8 definitely is, but also what about splat-args like zip or min. Why not stop at 4? Why not stop at 8 since its a power of two? Any hand-picked limit just feels pretty bleh to me. Either support everything or dont support it at all IMO

[–] [email protected] 2 points 1 year ago* (last edited 1 year ago)

Why overthink it. Stopping at the highest single digit decimal number is a fine choice. I'm more unsettled by the sequence starting at _1 instead of _0 if anything.

[–] [email protected] 2 points 1 year ago

If you need a lambda with 10 parameters you might consider aggregating those parameters into a struct or a hash instead. lambda are meant to be short functions