valuespace refactoring at rev 3964

4 views
Skip to first unread message

Edward K. Ream

unread,
Apr 8, 2011, 2:18:58 PM4/8/11
to leo-editor
Here is the checkin log, at an 3961.1.1:

QQQ
A straightforward refactoring of valuespace.py to use per-commander
controllers, and per-commander namespaces.

g.vs is now a dict of dicts, allowing cross-commander interactions,
but not making such the norm.

The namespace change could easily be undone if desired, but I think it
is simpler and better.

Also added the vs-dump command that dumps the namespace for the
present commander.
QQQ

As indicated, using self.dict rather than g.vs.__dict__ might be
slightly controversial, but it would be trivial to go back to the old
way. However, I think the new way is *much* better and safer.

In any case, wrapping the code in the

Edward K. Ream

unread,
Apr 8, 2011, 2:20:53 PM4/8/11
to leo-editor


On Apr 8, 1:18 pm, "Edward K. Ream" <edream...@gmail.com> wrote:

> In any case, wrapping the code in the

I hit the wrong key. To go on...

In any case, wrapping the code in the ValueSpaceController class is
much better packaging, and allows for more flexibility.

For example, the ctor defines the .trace and .verbose ivars, which you
can set as you like.

Next up, completing the docstring.

Edward

Edward K. Ream

unread,
Apr 8, 2011, 3:02:26 PM4/8/11
to leo-editor
On Fri, Apr 8, 2011 at 1:20 PM, Edward K. Ream <edre...@gmail.com> wrote:

> Next up, completing the docstring.

Done at rev 3965.

The docstring is probably fairly accurate because I referenced the
code while writing it, but it would be good to have Ville review it.

To do: documentation for SList expressions. I don't understand them yet...

Edward

Edward K. Ream

unread,
Apr 8, 2011, 5:20:52 PM4/8/11
to leo-editor


On Apr 8, 2:02 pm, "Edward K. Ream" <edream...@gmail.com> wrote:

> To do: documentation for SList expressions.  I don't understand them yet...

And I forgot @x, which is arguably the most important innovation.
I'll add it soon.

EKR

Edward K. Ream

unread,
Apr 8, 2011, 5:46:39 PM4/8/11
to leo-editor
On Apr 8, 4:20 pm, "Edward K. Ream" <edream...@gmail.com> wrote:

> And I forgot @x, which is arguably the most important innovation.
> I'll add it soon.

Done at rev 3966. This rev also fixes two crashers in the vs-create-
tree command. One was a previously-existing Python 3.x problem
(basestring does not exist, which is why Leo has the g.isString
function). The other is a crasher I created when I refactored the
code. (I forgot to add "self." to one call.).

So now all the commands work again, and the docstring is informative,
if not entirely complete.

Edward

Edward K. Ream

unread,
Apr 8, 2011, 7:09:21 PM4/8/11
to leo-editor
On Fri, Apr 8, 2011 at 4:46 PM, Edward K. Ream <edre...@gmail.com> wrote:

> So now all the commands work again, and the docstring is informative,
> if not entirely complete.

And possibly not entirely accurate either. Beware.

Ville, please check when you get a chance. Thanks.

Edward

Ville M. Vainio

unread,
Apr 9, 2011, 1:36:37 AM4/9/11
to leo-e...@googlegroups.com, Edward K. Ream
You are missing

@x =<var> {

text
to be
set in var

@x }


@x =<var>+ {

this body
will be appended to array <var>
(you need to have done "@x var=[] earlier")

@x }

Also note that <var> can be expression apart from just var name. e.g.

a.b
a['b']
a.getstuff().morestuff()['foo']

main thing is it's something that can be on LHS of

LHS = RHS

> --
> You received this message because you are subscribed to the Google Groups "leo-editor" group.
> To post to this group, send email to leo-e...@googlegroups.com.
> To unsubscribe from this group, send email to leo-editor+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
>
>

Ville M. Vainio

unread,
Apr 9, 2011, 7:27:10 AM4/9/11
to leo-e...@googlegroups.com, Edward K. Ream
I'll add these to docstring.
Reply all
Reply to author
Forward
0 new messages