Comment by ~andreyorst on ~technomancy/fennel
Aug 9, 2024 01:41:11 ~technomancy outgoing@sr.ht:
I was imagining something that worked like
clojure.repl/source
; in other words something that would use its argument's metadata to open a file on disk and read the source based on the resolved file/line.I see. Well, In that case I think it's still good to have this feature as a part of the REPL, since the language server is unofficial.
I wasn't proposing that the source for every function ever compiled be saved off in memory.
I wonder if this could be done, as it is more practical since the definition may change at runtime. IIRC there was a branch for source metadata?
Comment by ~andreyorst on ~technomancy/fennel
removed the math.acos use in the parser, and resent the patch, but the pipeline is failing with a weird error, not sure why.
Comment by ~andreyorst on ~technomancy/fennel
Figured it out: https://lists.sr.ht/~technomancy/fennel/patches/54487
I am concerned by math.acos however. But there's no way to portably generate strictly positive nan or strictly negative nan as we can't check the sign. Or at least I couldn't find a way.
Comment by ~andreyorst on ~technomancy/fennel
oh, it does seem that the parser doesn't recognize nan at all even if I add it as I did for inf. I don't get why.
Comment by ~andreyorst on ~technomancy/fennel
NaN is even weirder. In PUC Lua 5.4
0/0
is-nan
,math.abs(0/0)
isnan
, and-math.abs(0/0)
is-nan
again. In LuaJIT it isnan
, and-math.abs(0/0)
isnan
again. In Fengari it's the same as LuaJIT, so no negativenan
, except it is namedNaN
.From https://github.com/gvx/Ser/issues/4
Under Windows, Lua 5.1.5 doesn't seem to generate NaNs, only indeterminates, but it distinguishes both with tostring:
C:\Lua>lua5.1 Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio > print(to string(math.asin(2))) -1.#IND > print(tostring(0/0)) -1.#IND > print(tostring(-(0/0))) 1.#QNAN >
I'm not comparing strings, of course, but I kinda wonder how it should all work.
Comment by ~andreyorst on ~technomancy/fennel
also, maybe we should also support
NaN
in the same way? Encoding is ridiculous though:(+ (/ 1 0) (/ -1 0))
. Right now you can't read backnan
from view.
Comment by ~andreyorst on ~technomancy/fennel
~technomancy, WDYT should it be:
&-inf
or-&inf
?-&inf
makes more sense, although it's a bit weird?
~andreyorst assigned ~andreyorst to #237 on ~technomancy/fennel
Comment by ~andreyorst on ~technomancy/fennel
BTW, Fengari prints
(/ 1 0)
asInfinity
. This bit probably has to be supported too. I'll send a patch along with implementation of this ticket
Comment by ~andreyorst on ~technomancy/fennel
&inf
seems good to me, unless it would be confused with&rest
for destructuring something like infinite data structures