Fork me on GitHub
#clojure-dev
<
2023-09-21
>
jpmonettas21:09:02

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

hiredman21:09:03

for exceedingly simple expressions eval will use the eval path

hiredman21:09:47

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

hiredman21:09:27

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

jpmonettas21:09:32

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

jpmonettas21:09:21

or (if 1 1 2)

hiredman21:09:19

that doesn't count as an exceedingly simple expression

hiredman21:09:24

because of the control flow

jpmonettas21:09:56

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

hiredman21:09:23

maybe (+ 1 2)

hiredman21:09:37

(identity 1)

dpsutton21:09:00

for IfExpr?

hiredman21:09:00

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

jpmonettas21:09:12

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

hiredman21:09:27

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

jpmonettas21:09:41

yeah, that is why I was asking

hiredman21:09:46

I believe all exprs having .eval is vestigial

👍 1