Hi Benjamin,

The reason for that is because the local variables are syntactic sugar
over the load/drop/get-locals calls you are seeing. E.g:

IN: scratchpad [| x y | y sq x + ] .
[ 2 load-locals 0 get-local sq -1 get-local 2 drop-locals + ]

It is similar to how fry quotations are sugar over curry and compose:

IN: scratchpad [ 123 '[ 4 _ * ] ]  .
[ 123 [ [ 4 ] ] dip [ * ] curry compose ]

See also: https://github.com/slavapestov/factor/issues/758

I'm unsure of how the walker works, but I think it instruments the
code it tries to walk and then compiles it with the non-optimizing
compiler. So the quotation is executed verbatim which makes it easy to
know where the current execution point is. But locals and fry
quotations (and all kinds of optimizations for that matter) are
destructive one-way operations so you can't reconstruct the original
source code from the result.

I believe the general way to solve the problem is source maps -- You
include the original source of the word when debugging and then for
each stepping point in the words quotation, you map to a line number
and char position in the source code. ergs parser branch could make
adding such features easier.

2015-01-31 23:18 GMT+00:00 Benjamin Pollack <benja...@bitquabit.com>:
> The walker makes debugging words with locals a bit of a pain; you get a
> bunch of calls to load-locals/drop-locals/get-local/etc., rather than the
> actual variable names.  Assuming I'm not missing something about how to
> configure the walker to deal with this, where would I want to look to try
> improving things?


-- 
mvh/best regards Björn Lindqvist

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to