Closed danielmewes closed 9 years ago
@danielmewes
Thank you, One thing i want to add. I think it would be important for that after the default value you can submit another aarray or object that allows u to control if its a if else or if its a switch. Or a r.break term will need to be added so it will stop letting things fall though.
I think that we should simply allow r.branch()
to take 2N+1 arguments where N>=1. The current behavior of r.branch()
is simply the N=1 case.
i think thise is ur guys call on how you want to do this.....
As far as bike shedding goes, multi-branch if statements mean "cond" to my brain. I could live with switch. Branch is a bit weird, but I could probably get used to it in time.
I don't really like the name r.branch
either (I wanted to call it r.if_then_else
) but given that we already have the command r.branch
, I think we shouldn't introduce a new separate command.
Another vote for making branch
more powerful rather than adding another term. We already have so many that it's hard to keep track of them all.
Let's finalize this during the 1.17 ReQL discussion period, not now...
The only reason that i would recommend r.switch over r.branch is as a user first looking at rethinkdb and trying to find a way to do condations r.branch does not sound like its going to be for what i amlooking for i think it was @AtnNn that showed me that command. But as a devloper seeing a command called switch sounds like a switch statment.i would ad r.switch and deperatcate r.branch.
:+1: for extending r.branch
and not introducing a new term.
extending r.branch
seems obviously good.
I think r.branch sounds more like its forking something but fair enough for extending it as long as i dont have to use 10 of them.
Extending r.branch
seems obvious, are we considering renaming it as well?
I'd like to keep the renaming discussion separate and for later.
Marking as settled for making branch
variadic to support multiple branches.
:+1: fantastic idea to make r.branch
more powerful!
Done in next
as of bf5b28b
, CR 3201
@encryptio -- is there a docs issue?
@mlucy Writing an issue out now.
Currently the
r.branch()
term isn't that great to use if you have more complex case distinctions.Proposed by @wojons: Add a variadic term taking 2N+1 arguments
Its semantics are those of the following code block in C:
We could also make
r.branch()
variadic, instead of introducing a new term.