Re: [Factor-talk] Debugging words with locals

2015-02-11 Thread Benjamin Pollack
On Wed, Feb 4, 2015, at 10:23 PM, Björn Lindqvist wrote:
> 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:

[snip]

> 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.

Well, I guess that's what I was asking.  So the immediate answer is
that, no, the walker doesn't currently work via source maps; it's
working by instrumenting the non-optimizing compiler.  Implementing what
I want would therefore involve introducing source maps and doing a
fairly heavy rework of the walker to use them.

I don't think this is a project I'm keen on right now, but I'll file it
away for revisiting if I keep using Factor as heavily over the next
couple of months as I've been using it for the past couple of weeks.

Thanks,
--Benjamin

--
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


Re: [Factor-talk] Debugging words with locals

2015-02-04 Thread Björn Lindqvist
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 :
> 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


[Factor-talk] Debugging words with locals

2015-01-31 Thread Benjamin Pollack

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?
--
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