Open drkameleon opened 1 year ago
About this new type, how does should it work?
Well, the truth is this is something that remains to be studied.
A few thoughts...
on
) and one for emitting/triggering events (emit
).:event
typeA rough example of what I'm talking about:
on 'ctrlC [e][
print ["Received control-c event:" e]
]
or...
setNum: function [x,val][
previousVal: var'x
let x val
emit.with:#[
previous: previousVal
current: var'x
] 'numberChanged
]
on 'numberChanged [e][
print "Number changed!"
print ["previous value:" e\data\previousVal "current value:" e\data\currentVal]
]
a: 2
setNum 'a 3
print a ; a has become 3, and the event has been triggered in the background
That's a very rough sketch, but this is pretty much what I've had in mind 😉
The whole idea is very, very similar to that of functions; and that's a reason why I haven't implemented it yet. Now, that being said, the Ctrl-C idea for example is something that could be used with events (but obviously not with functions, as they are in Arturo), given that the "emitter" is the system itself.
Thanks for the explanation, I liked this idea!
Thanks for the explanation, I liked this idea!
Let's see... This needs some careful thought before!
For now, I would prefer it if we focused on existing issues & testing rather than adding something totally new, since - as it happens - with new features come new bugs. But it's definitely in my to-do list!
For now, I would prefer it if we focused on existing issues & testing rather than adding something totally new,Â
I totally agree with it! 😅
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing issue as stale.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
See also:
https://discord.com/channels/765519132186640445/829324913097048065/1084769083771330632