Is There Any Way To Develop in Smalltalk Without Using a VM?
I'm really be开发者_高级运维gining to learn Smalltalk. Now I'm using Squeak, but there is any way to develop in Smalltalk without using VMs, but something like an IDE?
An image in Smalltalk is analogous to VMware machine: it's simply a frozen state of a running Smalltalk application. All Smalltalks use images, and developing with one is the preferred way to do development in all Smalltalks. Likewise, all Smalltalks compile to bytecode and run on virtual machines, just like Java, .NET, Python, and others do. But that's completely unrelated to what program you use to develop a Smalltalk program, and how native the experience feels.
As others have mentioned, Squeak actually comes with an extremely good IDE—namely, all of Squeak. However, I don't think that's what you're actually asking. As best as I can understand, your question is either or both of:
- Can I develop for Smalltalk in tools I'm familiar with, in methods familiar to me? For example, on a file-by-file basis, in a normal text editor?
- Can I make normal-looking applications using Smalltalk?
Can I develop for Smalltalk in tools I'm familiar with?
In answer to the first: for nearly all Smalltalks, no. Smalltalk's file format was designed to be manipulated within a Smalltalk IDE, rather than directly in a text editor. That's why Squeak, Pharo, VisualWorks, VisualAge, and every other Smalltalk I've ever used avoid having you edit the source directly, and instead provide their own custom IDEs. Because these tools are cross-platform, their IDEs are generally not native, but rather represent an emulated cross-platform feel. While you can edit the source directly for all of these systems (for example, you can edit the foo.sources
file for a Squeak image, then use the Change Browser to load in your edits), no one actually does that.
There are two routes that might make you happier in this regard. First, as others have pointed out, GNU Smalltalk breaks the mold, and does, in fact, have an editor-friendly, file-based format. GNU Smalltalk did not run well under Windows last I checked, and is GPL-licensed, which may be a problem for you. But it does allow you to use the editor of your choice. Both vim and Emacs have syntax highlighting for GNU Smalltalk, and while I'm not aware of a package for NetBeans, Emacs, or one of the other major IDEs, it wouldn't be very hard to write one.
The second route you could take, if your only concern is that Squeak looks "ugly," would be to use Dolphin Smalltalk. Dolphin Smalltalk is a Windows-native version of Smalltalk. While its future is confusing at the moment, you may wish to take a look at it, as you would probably feel much more at home in its native environment, if Squeak's bothers you.
Can I make native-looking applications?
If you want truly native widgets, you have few options at the moment. Dolphin provides native widgets, but, as I mentioned previously, its future is currently uncertain. Squeak, VisualWorks, and GNU Smalltalk provide good FFI systems, and you could therefore make native UIs, but doing so would be comparatively arduous and complicated. So, basically: if this is very important to you, then, right now, using a Smalltalk may not be your best option.
Note that there are many applications for which having native widgets is not important. Games and kiosks certainly do not need to use standard widgets, but if you look around, very few mainstream apps bother to use them, either. Microsoft's own products are notorious for having custom look-and-feels, Chrome looks amusingly out-of-place on every platform it runs on, iTunes is amazingly popular despite looking truly bizarre on Windows systems, and so on. The plethora of interfaces on websites have also better acclimated people to nonstandard interfaces. So there's the real possibility that you simply don't care--and as Squeak's interface is highly themeable, making it look "pretty" when you near shipping will not be difficult.
(GNU Smalltalk does have very good Gtk+ bindings, which may be acceptable to you, depending on what you're trying to do. There are major applications, such as The GIMP and Pidgin, written against Gtk+ that look just fine in Windows. Nevertheless, I'd pardon you for not considering that a viable option.)
My recommendation
To be honest, I'd strongly encourage you to find one of the Smalltalks with an IDE you like, and use it. You'll be vastly more productive then trying to use a text editor, whether it's a glossed-up one like Eclipse, or a crappy one like Scite. You'll be missing an awful lot of Smalltalk's greatness if you go other routes: no REPL, inferior debugging, inferior code browsing, and so on.
If you insist on using a traditional development environment, the best option is GNU Smalltalk. You should carefully evaluate whether you're happy with its stability and performance on Windows before using it, and make sure you're comfortable with the implications of its GPL license, but if you are, it's the only Smalltalk that really and truly endorses a file-based development model.
Squeak is an IDE. The concept of "IDE" arguably came from Smalltalk! Do you perhaps want a "file oriented" workflow? GNU Smalltalk is one implementation that works that way.
Generally the answer is no because Smalltalk is not just a language, it's the environment too, including the changes that you make to it. You could translate it into a more static kind of system with a framework rather than a universe of live objects, but it would be a different thing. NeXTSTEP and thus Cocoa essentially did this. So the answer could be "sure, it's called Objective-C."
EDIT: All that said, see Logan's reference to GNU Smalltalk.
Using a VM does not prevent you from using an IDE. The question you should be asking is which IDE has good Smalltalk integration. Squeak is definitely the way to go for a Smalltalk IDE
Maybe others have other IDE's in mind, since you are already using Squeak and don't seem to be content. What exactly are you looking for that Squeak is not providing?
Working in a Squeak image can be really fun.
The environment is a bit confusing at first but it's very powerful.
Working in a live system makes it easy to explore and change things. You can take an object on the screen look at its state, play with it, browse the object class, run some code and see the world change.
The Smalltalk Browser is also much more focused on "browsing" the code than writing it. You can quickly find all the places where a class is being used (from compiler to http server) and understand how it all fit together.
Try getting used to the image for a while. I think you would loose something by using an external IDE.
If you load the SVI project from squeaksource, you can use VI bindings in the Smalltalk tools. I updated it to run in Squeak 4.1, not sure about 4.2.
精彩评论