clojure-dev

2023-09-21T21:47:02.879779Z

out of curiosity, what path in the Clojure compiler ends up calling something like IfExpr.eval()? I see the eval path being used for things like def, but I don't see what evaluation leads to IfExpr.eval() for example

2023-09-21T21:48:03.120709Z

for exceedingly simple expressions eval will use the eval path

2023-09-21T21:48:47.387409Z

so something like (+ 1 2) in isolation in eval might hit the eval path

2023-09-21T21:49:27.052809Z

but anything binding names or doing control flow doesn't eval

2023-09-21T21:49:32.556369Z

yeah I know, but I'm asking because even if I eval (if 1 :then :else) it doesn't take that path

2023-09-21T21:50:21.054409Z

or (if 1 1 2)

2023-09-21T21:50:19.827919Z

that doesn't count as an exceedingly simple expression

2023-09-21T21:50:24.443359Z

because of the control flow

2023-09-21T21:50:56.084189Z

so, what should I type into the repl to fire that piece of code?

2023-09-21T21:52:23.278929Z

maybe (+ 1 2)

2023-09-21T21:52:37.035429Z

(identity 1)

dpsutton 2023-09-21T21:53:00.391579Z

for IfExpr?

2023-09-21T21:53:00.964369Z

(I forget if any of the special optimizations around + would kick in before the eval path)

2023-09-21T21:53:12.206099Z

but how (+ 1 2) is going to be calling IfExpr.eval() ?

2023-09-21T21:53:27.342839Z

oh, it isn't, I don't think it is possible

2023-09-21T21:53:41.627759Z

yeah, that is why I was asking

2023-09-21T21:53:46.202579Z

I believe all exprs having .eval is vestigial

👍 1