Hi Peter,

I knew the shadow variable looked too easy! Oh well... :)

( sorry if I keep asking obvious questions, I'm not used to handling memory and 
the like. I'll have to read up on how memory is handled by nim, the gc, etc )

So you have compile master> master runs block1, forwards its 
memory/variables/procs etc ( how? ), then exits > block1 waits for block2 and 
so on?

Mmh I think there's still something I'm missing, as I don't see how you could 
preserve memory. I don't think just passing a pointer or something would be 
enough? Is there a way to avoid nim cleaning up memory when you close and 
executable? ( lol this sounds like intentionally leaking memory )

Unless you left all blocks running, all chained together?

Maybe you could serialize variables with 
[marshal](http://forum.nim-lang.org///nim-lang.org/docs/marshal.html) , 
extending it to keep name and type, and having python hold the serialized data, 
but this could prove difficult if we ever need to handle large datasets.

About assert, I was just asking as that is something we should document ( and 
maybe a magic of some kind could be added later on to disable -d:release )

Looks like you're right about Types, this works: 
    
    
    type A = object
        x: string
    
    var a = A(x:"hi")
    echo a # (x: hi)
    
    block:
        var b = A(x:"hi")
        echo b # (x: hi)
        type A = object
            x: int
        var c :A = A(x:1)
        echo c # (x: 1)
    

As a side note, this doesn't work: 
    
    
    type A = object
        x: string
    
    var a = A(x:"hi")
    echo a #(x: hi)
    
    proc sum(x,y:A):A=
        result = A(x: x.x&y.x)
    
    block:
        var b = A(x:"hi")
        echo sum(a,b) # (x: hihi)
        
        type A = object
            x:string
        var c : A = A(x:"ho")
        var d : A = A(x:"ho")
        
        echo sum(c,d) #type mismatch
    

But this is working as intended I guess, as A and block.A are different types 
as far as the type checker is concerned. Just something to keep in mind if we 
work with blocks.

Another question: how would you handle a block being recompiled? For examples, 
current executing block is block5, user recompiles block1. Would the new block1 
just be handled like if it was block6? ( I guess the answer is yes, as I can't 
think of any way this would break other things )

Thanks, Silvio

ps: sorry, I didn't intend on this reply becoming so long

Reply via email to