pub fn pre_bind_statement(source: CellRef, bindings: SymbolBindings) -> (SymbolBindings, CellRef) {
    use self::SafasCell::*;

    match &*source {
        // Lists are processed according to their first value
        List(car, cdr)  => { pre_bind_list_statement(Arc::clone(car), Arc::clone(cdr), bindings) }

        // Atoms bind to their atom value
        Atom(atom_id)   => {
            // Look up the value for this symbol
            let symbol_value = bindings.look_up(*atom_id);

            if let Some((symbol_value, _symbol_level)) = symbol_value {
                use self::SafasCell::*;

                match &*symbol_value {
                    Nil                     |
                    Any(_)                  |
                    Boolean(_)              |
                    Number(_)               |
                    Atom(_)                 |
                    String(_)               |
                    BitCode(_)              |
                    BTree(_, _)             |
                    Char(_)                 |
                    List(_, _)              |
                    Monad(_, _)             |
                    FrameMonad(_)           |
                    Syntax(_, _)            |
                    BoundSyntax(_)          |
                    Error(_)                |
                    FrameReference(_, _, _) => (bindings, symbol_value),
                }
            } else {
                // Not a valid symbol, or not defined yet
                // 
                // Most definitions aren't actually added to bindings until they can be accessed, so any symbols defined in the
                // current context won't yet be available at this point.
                // 
                // TODO: one issue here is that if there's a symbol that wants pre-binding but doesn't want to declare itself as
                // a 'forward' declaration it can't currently get any pre-binding behaviour (to fix this we need a 'pre-bound' cell type
                // that acts transparent in the main binding but is returned here)
                (bindings, source)
            }
        }

        // Normal values just get loaded into cell 0
        _other          => { (bindings, source) }
    }
}
///
/// Performs pre-binding to update the bindings prior to compiling a series of statements
/// 
/// The return value currently has no meaning other than to the pre-binding routines of other syntax elements. It's
/// usually the same statement again.
///
Performs pre-binding to update the bindings prior to compiling a series of statements
The return value currently has no meaning other than to the pre-binding routines of other syntax elements. It's
usually the same statement again.
Performs pre - binding to update the bindings prior to compiling a series of statements The return value currently has no meaning other than to the pre - binding routines of other syntax elements . It ' s usually the same statement again .
pub fn pre_bind_statement(source: CellRef, bindings: SymbolBindings) -> (SymbolBindings, CellRef) {
    use self::SafasCell::*;
    match &*source {
        // Lists are processed according to their first value
        List(car, cdr)  => { pre_bind_list_statement(Arc::clone(car), Arc::clone(cdr), bindings) }
        // Atoms bind to their atom value
        Atom(atom_id)   => {
            // Look up the value for this symbol
            let symbol_value = bindings.look_up(*atom_id);
            if let Some((symbol_value, _symbol_level)) = symbol_value {
                use self::SafasCell::*;
                match &*symbol_value {
                    Nil                     |
                    Any(_)                  |
                    Boolean(_)              |
                    Number(_)               |
                    Atom(_)                 |
                    String(_)               |
                    BitCode(_)              |
                    BTree(_, _)             |
                    Char(_)                 |
                    List(_, _)              |
                    Monad(_, _)             |
                    FrameMonad(_)           |
                    Syntax(_, _)            |
                    BoundSyntax(_)          |
                    Error(_)                |
                    FrameReference(_, _, _) => (bindings, symbol_value),
                }
            } else {
                // Not a valid symbol, or not defined yet
                // 
                // Most definitions aren't actually added to bindings until they can be accessed, so any symbols defined in the
                // current context won't yet be available at this point.
                // 
                // TODO: one issue here is that if there's a symbol that wants pre-binding but doesn't want to declare itself as
                // a 'forward' declaration it can't currently get any pre-binding behaviour (to fix this we need a 'pre-bound' cell type
                // that acts transparent in the main binding but is returned here)
                (bindings, source)
            }
        }
        // Normal values just get loaded into cell 0
        _other          => { (bindings, source) }
    }
}
pub fn pre_bind_statement ( source : CellRef , bindings : SymbolBindings ) -> ( SymbolBindings , CellRef ) { use self :: SafasCell :: * ; match & * source { // Lists are processed according to their first value List ( car , cdr ) => { pre_bind_list_statement ( Arc :: clone ( car ) , Arc :: clone ( cdr ) , bindings ) } // Atoms bind to their atom value Atom ( atom_id ) => { // Look up the value for this symbol let symbol_value = bindings . look_up ( * atom_id ) ; if let Some ( ( symbol_value , _symbol_level ) ) = symbol_value { use self :: SafasCell :: * ; match & * symbol_value { Nil | Any ( _ ) | Boolean ( _ ) | Number ( _ ) | Atom ( _ ) | String ( _ ) | BitCode ( _ ) | BTree ( _ , _ ) | Char ( _ ) | List ( _ , _ ) | Monad ( _ , _ ) | FrameMonad ( _ ) | Syntax ( _ , _ ) | BoundSyntax ( _ ) | Error ( _ ) | FrameReference ( _ , _ , _ ) => ( bindings , symbol_value ) , } } else { // Not a valid symbol, or not defined yet //  // Most definitions aren't actually added to bindings until they can be accessed, so any symbols defined in the // current context won't yet be available at this point. //  // TODO: one issue here is that if there's a symbol that wants pre-binding but doesn't want to declare itself as // a 'forward' declaration it can't currently get any pre-binding behaviour (to fix this we need a 'pre-bound' cell type // that acts transparent in the main binding but is returned here) ( bindings , source ) } } // Normal values just get loaded into cell 0 _other => { ( bindings , source ) } } }
Performs pre-binding to update the bindings prior to compiling a series of statements
The return value currently has no meaning other than to the pre-binding routines of other syntax elements.
Performs pre - binding to update the bindings prior to compiling a series of statements The return value currently has no meaning other than to the pre - binding routines of other syntax elements .
source
CellRef
bindings
SymbolBindings
source
CellRef
bindings
SymbolBindings