UltimateHackingKeyboard / firmware

Ultimate Hacking Keyboard firmware
Other
420 stars 66 forks source link

[Feature proposal] Scoping, and control flow #680

Closed kareltucek closed 1 year ago

kareltucek commented 1 year ago

As a followup to named variables, I would like to propose following new features, since working with control flow that consists of more than one command per basic block is pain:

E.g.:

if ($varA < 3) {
    tapKey a
    untoggleLayer    
} 
else {
    tapKey b
}
if ($varA < 3) ifNotInterrupted tapKey a
else ifShift tapKey b
while ($varA < 3) {
    tapKey a
    setVar varA ($varA+1)
}

Is this functionality desired?

mondalaci commented 1 year ago

Your proposal looks very impressive. I'm not a heavy smart macro user, but I'm sure many forum folks would appreciate these features, and you're welcome to ask around in the forum.

How about RAM usage regarding per-scope states and, in general, regarding these features?

kareltucek commented 1 year ago
mondalaci commented 1 year ago

Thanks! The memory consumption seems reasonable. Feel free to go ahead with this.

likern commented 1 year ago

I'm a heavy macros user, would be liked to try this feature. Actually this is exactly what I hoped since macros invention - using normal programming language. Because macros more suitable for simple things, and are difficult to compose together (and understand what macros actually does)