Ok, i think i've gotten to the bottom of it. The original implementation: (define (make-info name location description) (curlet))
gets marked as VERY_SAFE byt the optimizer (specifically the optimize_lambda function). According to the docs, "A safe function does not push anything on the s7 stack, and treats the arglist passed to it as immutable and temporary". I'm trying to return the arglist, which violates the "temporary" descriptor above. Maybe the optimizer needs to be less aggressive? not sure, i'm gonna stick with the "inlet" version for now. Thanks, Woody On Fri, 2021-09-24 at 14:48 +0000, Woody Douglass wrote: > Yeah, creating a let explicitly like that works -- i'm at a point > where > i can move on now, i'm just trying to figure out why i saw the > aliasing > from my original implementation -- why doesn't returning the lambda's > implicit let work in the way that i expected? > > Thanks, > Woody > > On Fri, 2021-09-24 at 07:36 -0700, Iain Duncan wrote: > > CAUTION: This email originated from outside of the organization. Do > > not click links or open attachments unless you recognize the > > sender. > > > > Don't know if this is helpful because I doubt this is new to you, > > but > > I have done something like the below: > > > > ; returns inner let > > (define (my-obj arg val) > > (let ((arg val) (foo 'bar)) > > (curlet))) > > > > In my use case it's bigger because I actually have objects that can > > return their let on a specific message to allow monkey patching > > them > > from the repl. > > > > On Fri, Sep 24, 2021 at 7:30 AM Woody Douglass < > > [email protected]> wrote: > > > I figured out that I can explicitly copy the current environment > > > with > > > inlet, so my function is now > > > > > > (define (make-info name location description) (inlet (curlet))) > > > > > > This works for my purposes, but is it idiomatically correct? > > > > > > Thanks, > > > Woody > > > > > > On Fri, 2021-09-24 at 09:41 -0400, Woodrow Douglass wrote: > > > > I'm trying to write a function that makes a simple dictionary > > > > of > > > > informaton > > > > > > > > (define (make-info name location description) (curlet)) > > > > > > > > but it seems that let gets reused or something -- the values > > > > seem > > > to > > > > change when the function gets called more then once > > > > > > > > i could just use associative lists by doing > > > > > > > > (define (make-info name location description) (let->list > > > (curlet))) > > > > but i really like how lets work (applicable, etc...) > > > > What assumption have i gotten wrong? why doesn't a new let get > > > > created > > > > per function call? > > > > > > > > Thanks, > > > > Woody Douglass > > > > > > _______________________________________________ > > > Cmdist mailing list > > > [email protected] > > > https://cm-mail.stanford.edu/mailman/listinfo/cmdist > > > > > _______________________________________________ > Cmdist mailing list > [email protected] > https://cm-mail.stanford.edu/mailman/listinfo/cmdist _______________________________________________ Cmdist mailing list [email protected] https://cm-mail.stanford.edu/mailman/listinfo/cmdist
