1 Mar 09:45
Re: [Spirit2x] symbols with stack of Lookups for static scoping...continued
Carl Barron <cbarron413 <at> roadrunner.com>
2009-03-01 08:45:22 GMT
2009-03-01 08:45:22 GMT
On Feb 26, 2009, at 3:51 PM, Bernard Hugueney wrote: > Dear Spiriters, > > I implemented a scopes<Lookup> that contains a std::vector of > Lookup, allowing > me to easily parse symbols (variable names) from different scopes. > > However, I would like to be able to prevent redefinition of a > variable in the > same scope (while allowing a new definition to shadow previous > definitions). > > In order to do that in a clean and efficient way, I thought I should > define > another Lookup: current_scope< scopes<Lookup> >. The current_scope > would hold a > reference to the scopes and forward member function call to the > topmost Lookup > from the stack (in fact, to the back() of the std::vector<Lookup>). > > However, I would not be able to default-construct this current_scope > Lookup, so > I would need a way to initialize the lookup field in symbols at > construction > time, with a "lookup(new Lookup( customDataFromConstructor))". > In my case, the customDataFromConstructor would be a reference to my > scopes<> > previously constructed.(Continue reading)
RSS Feed