Re: [docs and wiki] How many data-types do we emphasize?

new topic     » goto parent     » topic index » view thread      » older message » newer message
katsmeow said...


I'd like to stress the user type, the way OE implements it now.

1) it's faithfully called on every assignment

2) it's programmable!!!

3) there seems to be no limit to how many unique types there are in a program or include

Kat

Thanks Kat:

As you point out, it also goes beyond just enforcing a type. I find this sort of thing helpful:

-------------------------------  
global type db_err(object x) -- trap eds errors in db procedures;  
-------------------------------  
if x != DB_OK then -- show popup message as well as in the terminal (if used): 
    display("Database Error: [] [] []",{x,decode_err(x),get("input_entry.text")})  
    Error("MainWin",format("Database error code []",x),  
        format("DB: []",{get("input_entry.text")}), -- db name user entered;  
        format("[]",{decode_err(x)}),GTK_BUTTONS_OK) -- from db error table; 
    return 1  
end if  
return x = DB_OK  
end type  
 
db_err x = db_open("bad.edb") -- open, or issue warning, no crash. 
 

Nearly identical routines can create tbl_err and rec_err types, to handle calls such as db_create_table, db_select_table, db_insert, etc.

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

Search



Quick Links

User menu

Not signed in.

Misc Menu