News for hackers. Stuff that matters.
Re:The Bagel Language by kybernetikos on Monday September 20, 2021 @07:34AM (#28592634)
One of the fun possibilities is that funcs could be safely turned into a serialized version for sending over the wire etc.

Will bagel have a json equivalent?

Re:The Bagel Language by brundolf on Monday September 20, 2021 @11:39AM (#28594988)
Bagel values will fundamentally be JavaScript values, so the same subset of them will naturally translate to JSON

With that said I hope to give stronger typing to what's allowed to be converted to JSON, since JavaScript's serialization will happily eat up class instances (losing class information), dates (silently converting them to strings), undefined, etc.

Re:The Bagel Language by brundolf on Monday September 20, 2021 @08:38PM (#28600778)
Edit: Just noticed you said funcs and not func results

This isn't really true, since they'll still capture their closures and will definitely be able to reference other constructs like classes, etc

Re:The Bagel Language by kybernetikos on Tuesday September 21, 2021 @07:24AM (#28603932)
Changing mutable state you've closed over is a side effect, so from your description I assumed that wouldn't be allowed in a function.

Or are you talking about reading mutable state you've closed over where you're still a pure function (just with hidden arguments) but the environment might change and you can't send that over the wire.

Re:The Bagel Language by brundolf on Tuesday September 21, 2021 @05:48PM (#28610435)
That's what I mean. Functions can't mutate anything, period- the assignment operator won't even parse, and calls to procedures are forbidden. But they can still close over state that is mutable one other contexts

The full implications of allowing this in closures have yet to be explored and I still need to make sure they won't break the guarantees I'm wanting to offer