New syntax and the BLOX browser

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

New syntax and the BLOX browser

Diego Fernández
Hi, I'm new to GNU Smalltalk, and I was trying Blox in the lastest
version of GST (from the devo repository in Arch).

When a method source is displayed the browser shows the "[" "]" used
by the new script syntax.
I like the script syntax, because is nice when writing scripts... but
in the browser I think that is better to display methods without the
"[" "]".

It's intentional or it's a bug? Can I help to change this?


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: New syntax and the BLOX browser

S11001001
Diego Fernandez wrote:
> It's intentional or it's a bug? Can I help to change this?

It's intentional in the sense that source code in string form for
methods should now have those brackets.  The browser currently just
shows whatever the source code property is, and compiles it directly
using the standard methods.

I believe the place to make changes of the kind you desire is directly
in the Browser.  If you want to work on a patch to the Browser for this,
it would be welcome.  You should first apply the patch in
http://lists.gnu.org/archive/html/help-smalltalk/2007-10/msg00051.html,
which alters source code semantics and is likely to be applied soon to devo.

I cannot tell you much else about the Browser implementation, but I
think the GSTParser and the positioning information that RBProgramNodes
provide would be useful in implementing this.  Feel free to join us
(http://smalltalk.gnu.org/wiki/irc) if you'd like to chat about it.

--
;;; Stephen Compall ** http://scompall.nocandysw.com/blog **
"Peta" is Greek for fifth; a petabyte is 10 to the fifth power, as
well as fifth in line after kilo, mega, giga, and tera.
   -- Lee Gomes, performing every Wednesday in his tech column
      "Portals" on page B1 of The Wall Street Journal


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: New syntax and the BLOX browser

Paolo Bonzini-2
In reply to this post by Diego Fernández
Diego Fernandez wrote:
> Hi, I'm new to GNU Smalltalk, and I was trying Blox in the lastest
> version of GST (from the devo repository in Arch).
>
> When a method source is displayed the browser shows the "[" "]" used
> by the new script syntax.
> I like the script syntax, because is nice when writing scripts... but
> in the browser I think that is better to display methods without the
> "[" "]".

It is intentional, though it does not really work without the patch that
Stephen pointed you to (and even with the patch, I haven't tested that
particular case).

The problem is that single-method compilation is needed in two cases:

1) in the browser, and there one would like to avoid the brackets

2) when the definition of a class changes, and there you need to
recompile exactly what was in the source code (including the brackets).

So, there are two opposing behaviors, both of which may be desirable.

I must say I'm not very motivated to implement this, so unless someone
steps forward, you'll have to write brackets in the browser too.  :-)
On the other hand, it should be possible to "unbracket" the methods when
they are chosen and "rebracket" them just before accept.  As Stephen
hinted, both can be done relatively easily, by creating a parser
(CompiledMethod>>#parserClass) and parsing the message pattern.

When unbracketing, you scan to the next token and save its position,
then you scan all the method and save the position of the last token,
and finally you use copyFrom:to: to remove the brackets.

When rebracketing, you scan to the message pattern, and use copyFrom:to:
to split the method in two parts.  Then you put them together with
brackets around the second part.

Unfortunately, there is no single place in which to do this change,
because there is no common for MethodSetBrowser and
ClassHierarchyBrowser.  So, a first (very much welcome) step would be to
refactor these two to have a Browser superclass.  If you need help,
write here so we can help you and put the result on the wiki (a "GST
hacker's guide" is another sorely missing part of the wiki).

Paolo


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk