Home   Archive   Permalink



Rebol View layout compose, seek minima notation

I attempt to break down a Rebol View into a Forth style 'divide and conquer' word set, to optimize reading, organize, make business logic stand out.
    
1) Is there a way to simplify the following code ?
    
    
        R E B O L []
        
        Result: "Test"
        
        field1.Process: [
                    alert join "You typed: "
                    Result: field1/text
                    ]
        
        field1.Initialize: [do [field1/text: Result]]
        
        field1.Declare: compose/deep [
                field1: field
                [(field1.Process)]
                (field1.Initialize)
            ]
        
        block:     compose [
                (field1.Declare)
                field
                field
                ]
        
        view layout (block)
    
2) Layout block structure being
    
    field: field-type [field-process]     [field-initialize]
    
I seek to optimize notation
    
    field1.Process: []
    field1.Initialize: [do []]
    
    field1.Declare: compose/deep [
            field1: field
            [(field1.Process)]
            (field1.Initialize)
        ]
    
towards minima
    
    field1.Process: []
    field1.Initialize: []
    
    field1.Declare: compose/deep [
            field1: field
            [field1.Process]
            [field1.Initialize]
        ]

posted by:   OneArb       9-Jun-2014/12:35:57-7:00



Due to this question, there is now a rebol tag set up on CodeReview StackExchange. Check it out:
    
http://codereview.stackexchange.com/questions/53794/
    
I added my $0.02

posted by:   Hostile Fork       9-Jun-2014/13:14:13-7:00



Based on what I think you intend, you could use 'style in the GUI layout:
    
R E B O L []
result: "Test"
field1.Process: [
     alert join "You typed: "
     Result: face/text
]
block: compose [
     style field1 field (result) field1.Process
     field1
     field1
]
view layout block
    
Do you intend for 'result to be global? Some more info about what you're actually intending (not just a generalized model) may help me answer your specific question more clearly.

posted by:   Nick       10-Jun-2014/1:15:47-7:00