Eigenstate: myrddin-dev mailing list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

__init__()


__init__ functions are now working.

Any function named __init__ will be called before
main(), allowing you to initialize your library,
set up custom formatters for your data types, open
files, etc.

These initializers are called in reverse topological
order, which means that all of your dependencies will
have had their initializers called (if they have them)
before yours are called. For example:

    use std
    const __init__ = {
        use_std()
    }

Is perfectly valid, because it's guaranteed that any
initialization done in 'std' is finished before the
__init__ function in question is called.

Disclaimer:

Magical pre-main code can be confusing, Please use
gently. Side effects include confusion and internal
bleeding. Do not take orally. Not to be used for the
other use.

-- 
    Ori Bernstein

Follow-Ups:
Re: __init__()Ori Bernstein <ori@xxxxxxxxxxxxxx>