Re: minimanual.pdf -- comments requested

new topic     » goto parent     » topic index » view thread      » older message » newer message

In general, all of your comments are valuable and will end up fixing the re-write of the MiniManual.

petelomax said...

On a fresh install, can you not just double-click on wee.exw?

The Linux (bound|compiled) version does not open a terminal to execute a program. If you launch WEE from a terminal then at least you have that terminal to display output. Got to complain about this...

petelomax said...

You can easily attach any routine_id to any data; there is no need to declare a class or carefully construct a complicated hierarchy of inheritance just to get the right routines to be associated with some particular data.

I have tried to come up with a short demo to show this:

First an included file: temp.e

namespace temp 
 
export atom New, Set, Get, Show, Convert   -- actions 
export enum Temp, Units                    -- data-objects 
export enum C, F                           -- fixed values 
 
-- these subroutines are hidden from the end user 
 
function set( object entity, integer item, object value ) 
    entity[2][item] = value 
    return entity 
end function 
    Set = routine_id( "set" ) 
 
function get( object entity, integer item ) 
    return entity[2][item] 
end function 
    Get = routine_id( "get" ) 
     
procedure show( object entity, integer item ) 
        if item = 1 then 
            printf(1, " %g", entity[2][1] ) 
        else 
            printf(1, entity[2][2] ) 
        end if 
end procedure 
    Show = routine_id( "show" ) 
 
 
function convert( object entity ) 
    if entity[2][2] = C then 
        entity[2][1] = entity[2][1] * 9/5 + 32 
        entity[2][2] = F 
    else 
        entity[2][1] = (entity[2][1] - 32 ) * 5/9 
        entity[2][2] = C 
    end if 
    return entity 
end function 
    Convert = routine_id( "convert" ) 
 
function new() 
    return { {New,Set,Get,Show,Convert}, {Temp,Units} } 
end function 
    New = routine_id( "new" ) 
 
-- this one function calls the desired subroutine when needed 
export function T( object action, object entity = "", integer item = 0 , object value = "") 
    if action = New then 
        return call_func( New, {} ) 
    elsif action = Set then 
        return call_func( Set, { entity, item, value } ) 
    elsif action = Get then 
        return entity[2][item] 
    elsif action = Show then 
        if item = 1 then 
            printf(1, " %g", entity[2][1] ) 
        elsif item = 2 then  
            if entity[2][2] = C then 
                printf(1, " oC" ) 
            else 
                printf(1, " oF" ) 
            end if 
        end if 
    elsif action = Convert then 
        return call_func( Convert, {entity} ) 
    end if 
    return 0 
end function 

Then the main file: hotness.ex

include temp.e 
 
printf(1, "First entity is inside a room\n" ) 
    sequence room = T(New) 
        room = T(Set,room,Temp,15) 
        room = T(Set,room,Units,C) 
    T(Show,room,Temp) T(Show,room,Units) 
        room = T(Convert, room ) 
    printf(1, "\n after temperature conversion\n" ) 
    T(Show,room,Temp) T(Show,room,Units) 
 
printf(1, "\nSecond entity is outside the building\n" ) 
    sequence outside = T(New) 
        outside = T(Set,outside,Temp,-5) 
        outside = T(Set,outside,Units,C) 
    T(Show,outside,Temp) T(Show,outside,Units) 

Ideas for short demos are welcome.

petelomax said...

The lack of an index/table of contents limits the usefulness of this severely, imo.

How are you looking at the PDF? On Linux Mint the default viewer shows a "table of contents" as a side pane automatically--no work required.

An index is going to take some work, but I can try.

Thanks, _tom

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu