4 ms·
I think you're reading it wrong. `enter` isn't imperative. You're asking for the `enter` selection, which is the list of entering nodes. Same thing with `exit`.
by krebby 10y ago
I think you're reading it wrong. `enter` isn't imperative. You're asking for the `enter` selection, which is the list of entering nodes. Same thing with `exit`. Calling either of those methods doesn't actually alter any data
- morgante 10y agoI know enter isn't actually imperative. That's the problem: it looks like it should be. If I write "node.enter()" it definitely looks like I'm making the node is being made to enter if you aren't well-versed in d3.
- jdmichal 10y agoAnd SQL `SELECT` statements looks like I'm actively selecting something, when in reality I'm declaring what bits of the table I want returned... All syntax looks opaque until you understand the underlying concepts.
- morgante 10y agoUh, a SQL SELECT statement is actively selecting something. You're selecting what you want to return. Terrible example. The problem with "enter" is that nothing will happen if you simply use enter by itself. Yet it's an active verb which seems to imply that something will be made to enter.
- Retra 10y agoSQL SELECT declares what will be selected when the query is run. The query engine does the selecting, including figuring out how best to do it.
- morgante 10y agoYes, SQL is declarative. But you still "SELECT" something to look at. A SELECT statement is, by itself, sufficient to get something to happen (for results to be fetched). On the other hand, a D3 enter() does absolutely nothing by itself. You must do further calls for it to have any impact. This is very off topic and ridiculous.
- jdmichal 10y agoOK, if a SELECT statement is sufficient by itself, surely you can tell me the results of this: SELECT * FROM stuff WHERE thing=2 Of course you can't. Because every declarative process has two main steps: declare and execute. SELECT and enter() both only declare; they must then be executed against data in an engine to produce a result.
- Retra 10y agoWhat we mean when we say "SQL is declarative" is that it doesn't provide instructions on how to carry out a task, and instead only provides a description of the outcome of the task, once it's been carried out. SELECT is declarative because it doesn't tell the computer how to do a query. SELECT tells the interpreter what you want not how to get it.