> Finally, how to deal with expressions involving parsing words is still
> an open problem. I.e. if you do this at the listener:
>
>    TUPLE: abc x y z ;
>
> quite a bit of work is done as a result of parsing the
> statement. A fileout mechanism would have to notice the
> existence of the 'abc' class and fileout the proper TUPLE statement.

This is already supported, I use this all the time to remind myself
what the slots of a tuple are, etc.

( scratchpad ) TUPLE: abc x y z ;
( scratchpad ) \ abc see
IN: scratchpad
TUPLE: abc x y z ;

Personally though, I think this approach, where you edit code in the
image, and file in/out for import/export only, is flawed. I know in
the past I'd talk about having an in-image "structure editor" as a
long-term goal for Factor, and now I realize what I want is actually
different. I do want smart editing features -- code completion, and so
on -- but editing s-expressions directly in the image is not how I
will acheive this goal.

First of all, with in-image editing, you end up losing comments,
indentation and formatting in a parse-unparse round-trip. Automatic
prettyprinting can only get you so far; I want to have the freedom to
arrange words in any order in my source file, with comments between
them, top-level forms, etc. Elevating all of these syntactic elements
to first-class status in the language just adds needless complexity
and only ends up simulating what can be achieved easier otherwise.

Also, if you have to edit code as s-expressions in a "structure
editor", all intermedaite edits then have to be well-formed
syntactically; this seems too constraining, and makes even simple
things like copy and paste difficult. Again, you can have a fancy
structure editor which tries to simulate this, but why not just edit
text in a buffer instead?

Certain syntax sugar is lost in a parse/unparse round-trip, for
example 'fry', parsing words such as the Objective C bridge -> syntax,
and other stuff like that. A more complex parser can record parsing
word expansions, but again...

Finally, you want a way to edit code without loading that code into
memory. For example, if I'm working on a compiler refactoring, editing
one word at a time and having that word (which is part of the
currently live compiler) take effect immediately would make it very
hard to make big changes. You could come up with a system where word
changes don't take effect immediately and have to be committed, but
this would complicate the vocabulary system internals. Or, if I rename
some word using a fancy 'rename word' tool, I want all usages, even
those in platform-specific I/O code and so on, to be updated.

I'd rather have a smart text editor which parsed source code on the
fly -- using the same parser that the language core uses -- and
offered semantic navigation, code completion, refactoring, error
checking, and so on. This seems a lot simpler and cleaner than
in-image editing. An added bonus is that the language core does not
have "IDE" functionality built-in; all that stuff is kept separate.
You can implement all of the same cool features that a "structure
editor" can give you, with a much cleaner design.

Basically, I want to take Factor in a direction where the tools
resemble something like Eclipse or LispWorks, and not Squeak or
InterLisp. I still think 'see' and the prettyprinter are useful
debugging tools, and they'll never go away, but I don't intend to
extend them to support 'file-out'. It just seems like the wrong
approach to me.

Slava

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to