Home   Archive   Permalink



Live coding workflow like Red's Eve clock demo

http://www.red-lang.org/2016/07/eve-style-clock-demo-in-red-livecoded.html
    
Was wondering if this was possible to whip up quickly in rebol. Hot reloading/live coding is popular these days for good reason. Figwheel for clojurescript is pretty sweet. Elm has it as well.

posted by:   adam16ster     29-Jan-2017/18:23:20-8:00



Are you most interested in the app example, or the tiny livecoding 'framework'

posted by:   Nick     30-Jan-2017/3:27:48-8:00



This is the entire livecode framework in Red:
    
https://github.com/red/code/blob/master/Showcase/livecode.red

posted by:   nick     30-Jan-2017/4:08:06-8:00



The 1 minute answer in R2:
    
R E B O L [title: "livecode"]
print ""
gui: [
     b: box 400x200
     a: area
]
w: view/new layout gui
forever [
    if attempt [g: layout/tight load a/text] [b/pane: g show b]
    wait .1
]

posted by:   Nick     30-Jan-2017/4:20:31-8:00



Don't know if its quite the same as other tools mentioned though. The rebol/red script is essentially just refreshing and loading the app anew right? Tools like Figwheel inject to live running code and maintains state. Noob here so be easy.

posted by:   adam16ster     6-Feb-2017/14:21:41-8:00



Nope, even in the example above (and in the Red version linked), state in app is maintained. We're just creating our own event loop and selectively updating what we want with 'show - the user just happens to be able to input the code which gets evaluated in the app above.

posted by:   Nick     6-Feb-2017/17:44:07-8:00



Try this:
    
R E B O L [title: "livecode"]
name: ask "Type your first name here: "
gui: [
    b: box 400x200
    a: area
    f: field "Now type some else's name here" [name: copy face/text]    
]
w: view/new layout gui
forever [
    if attempt [g: layout/tight load a/text] [b/pane: g show b]
    print name
    wait .1
]

posted by:   Nick     6-Feb-2017/17:48:47-8:00



Change the name as many times as you want. The value is maintained, until the user interacts with text field and triggers its action block to evaluate, not just upon 'refesh' of our home made event loop. And all along, the code of the pane in the box can be updated as desired. The entire app isn't 'recreated' - only what we choose to change in the code which makes up the app.

posted by:   Nick     6-Feb-2017/17:54:45-8:00



Thanks Nick. Amazing stuff. Just when I think I've found some new programming feature Rebol doesn't have...nope, try again.

posted by:   adam16ster     13-Feb-2017/9:12:08-8:00