简体   繁体   中英

On Smalltalk IDEs (Squeak, VisualWorks, etc), how can you navigate away from a message's code you're working on to inspect another?

In every IDE I've tried so far, if I'm partway through writing a message and need to look at the code of another, the browser asks me if I want to save. But if I say I do want to save, it actually tries to compile/syntax check the code, and refuses to perform the save if it does not pass. The only way to view the source of another message seems to be to say "no" to save and have everything wiped. How can I look at another class incidentally, or save code I am partway through working on that might not build right now?

Smalltalk is a multi-browser system. You'll need to have lots of different browsers open. Smalltalk is opinionated. The system browser (Nautilus) doesn't make it easy to view long methods, steering you towards writing short ones. It doesn't make it easy to have non-compiling code in a method, to steer you towards making small changes.

Experimental/prototypical code you might want to have in a Workspace/Playground. That can save to disk.

We are aware that it is an issue for people new to Smalltalk. We tried some fixes, they were a lot worse.

For now there is no easy way to do that. The two easiest opting are

  1. Make the current method syntactically correct and save it.
  2. Open another browser. If you want to see a class or method that is in your current code, you can cmd+click it or use "browse it", "implementors of", shortcuts that will open another window.

Also in you can use GTSpotter to quickly find what you are looking for and preview its source code

When you say "this seems like a pretty huge thing to be missing, and it could be gotten around by just having the option to use a regular editor" I'm afraid you've entirely missed the point.

Understandable, though -- happens to us all. Or did. Perhaps it was long ago, but we were all there.

You might be thinking about the task in terms of scrolling a giant text up and down to find what you want. Scroll up -- read a little -- scroll back -- and continue making your changes.

And when you say " I can't imagine any circumstance where it is OK, in pursuit of any agenda, to throw away the coder's work against their will "

you are spot on correct, of course.

Imagine -- scrolling around, making dozens of little changes, and before you've saved them -- poof -- they're all thrown away -- a mistake, perhaps, but completely against your will. That would be awful . We're agreed.

(In fact, the editor I'm using to type this
is like that -- I can scroll around the whole thing,
making little improvements, all over, but it could
all go --poof-- and disappear, All of it.
Fairly common occurrence, when editing the web. )

So let's try another run through that same task.

You get one little teensy, DUMB AS A POST editor,
where you can only see one thing at a time.
And now you just want to scroll somewhere else,
for a moment, and come right back.

Which actually means that

you are attempting to look up a second method,
while already changing a first method
(which would require the browser to
forget the context of the first method,
and move to the second).

The browser does not know how long you will be away from this context.
You might go chaining along from place to place, stop and read an email,
take a call, and go to lunch.

So, the browser cautions

"Hey - want to save this first?"

as if to say:

"
  Hey - I can't imagine any circumstance where it is OK,
  in pursuit of any agenda, to throw away the coder's work
  against their will.

  So listen up, coder.

  You want to save this first?
"

But you can't save it.
You must first look something up.
Conundrum.

Ah-ha! There is a list of methods in that other pane.
One of them is highlighted.

Not those -- that one.

As if to say

" Thanks.  Good catch.
  Yes, I know - can't though.
  I need to change contexts.
  You stay right here.
  And give me another context
  to go wandering about in.
  please.
"

Soon, I expect, they'll start actually talking.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM