squeak

In Squeak, how to wrap every method send?

I created a class, and in that class I have a method 'sendMessage: to: withArgs:' which recieves an object, a message and an array of arguments. The method is used to send messages to object and perform some algorithm. To use this method I have to create an instance x of the class I created and do something like x sendMessage: '+' to:...

How to create a global variable in Squeak?

I don't mean a class variable. I want a variable that can be used everywhere. Where should I define it? [in squeak] ...

Squeak System Browser Questions

I am using (a school modified version of) the "Squeak By Example" (SBE) image for a OOP/OOD class. However, my System Browser is missing a few features that appear in SBE. I assume there are some configuration options that can get them back for me, but I can't find them yet. My questions are: 1) How do I get the buttons back? In the bo...

Why does the Squeak interface look and act so antiquated?

Don't get me wrong - I love Smalltalk, but... To me, the Squeak interface is one of the biggest turnoffs. I love Smalltalk - not the user interface. One only has to contrast modern interfaces like GNOME, MacOS X, and Windows Vista with their combination of ease of use and visually pleasing eye-candy with Squeak's flat 2-D cartoony 16-...

Initialize an object with an array

I was going through (using Squeak) the Discovering Better Code: Bowling for Smalltalk Series by Ron Jeffries and I can't get pass through the third article. A new class (called Frame) is being created which takes an array as an argument in the constructor. Frame class>>new: anArray ^self new setRolls: anArray Frame>>setRolls: anArra...

Squeak - How do I move a circle?

In the Squeak Smalltalk environment, I am trying to learn Morphic. There are many, many Morphic classes and I cannot determine the most appropriate one(s) to use for my current application, and I prefer not to invent anything that already exists at this point. Links to relevant code/info would be appreciated. While Pharo might be nicer, ...

Referencing a morph in Squeak (Mophic) created by direct manipulation via 'code'

How do I reference (i.e. program) a Morph created by direct manipulation, for instance dragging a text box from the supplies menu to the desktop, via Squeak/Smalltalk code in say the workspace? I'm okay (well sort of - I'm just learning Morphic) when I instantiate a Morph via Squeak/Smalltalk code but I'm at a loss when I've dragged a ...

Magma, GOODS, GLORP, or something else?

So I've been using Smalltalk for about 6 months now (Squeak and Pharo), mostly doing data analytics, and I'm about to start my first Seaside app. So my question to all you Smalltalkers out there is, what is your favorite persistence solution? I've been looking at Magma, GOODS, and GLORP. I'm a long-time python hacker, so I get ORM, but i...

Context-menus in Squeak

I am using Squeak (can't use Pharo), and I have a Morphic application and I wish to add my own custom Context-menu (I don't want to add to or use the Halo menu). How do I build my menu and make it come up on a right-click (yellowButton, sigh)? I currently have a CustomMenu and a handlerForYellowButtonDown: which calls the menu startup....

Generating printable output within Squeak

I'd like to create a printable output file from within Squeak, for instance to create a report. I've done a little Googling and I'm surprised by how little material in the way of examples relating to creating printable files exist. However, I've found a couple of classes class called PostscriptCanvas and EPSCanvas and a method within i...

Invoking shell commands from Squeak or Pharo

How can you invoke shell commands from Squeak and Pharo? Do these environments have anything in them like the system() function in certain unix languages to run external shell commands, or the backticks (can't make them here do to the editor, but what you get when you push the key left of "1" and above "TAB") to capture the output of com...

What are other modern, free analogs of Squeak and Esterel?

A long time ago, Rob Pike and Luca Cardelli wrote a paper called "Squeak: a language for communicating with mice". It was based on Hoare's communicating sequential processes, but it was compiled into single-threaded C code - no threads or scheduler at runtime. However, I can't find a compiler for Squeak, and Rob Pike went on to write new...

Create from scratch, or build up on Scratch?

I'm considering building a visual programming language, akin to Scratch, for use by children (a.k.a. poor typists) in programming micro-controllers or robots. There is, for example, a project to build a graphical programming environment for the Arduino. I really like Scratch, and would like the graphical coding to be similar. Scratc...

Smalltalk - Compare two strings for equality

I am trying to compare two strings in Smalltalk, but I seem to be doing something wrong. I keep getting this error: Unhandled Exception: Non-boolean receiver. Proceed for truth. stringOne := 'hello'. stringTwo := 'hello'. myNumber := 10. [stringOne = stringTwo ] ifTrue:[ myNumber := 20]. Any idea what I'm doing wrong? ...

Smalltalk - Inserting a TAB character (Visual Works)

I'm having some trouble inserting a tab between two strings. stringOne := 'Name'. stringTwo := 'Address'. I've tried: info := stringOne, String tab, stringTwo. or info := stringOne, Character tab asString, stringTwo. But none of those two messages are understood. I'm using Visual Works. ...

Passing functions as parameters in Squeak

Since Squeak is purely Object Oriented I'm fairly certain that you should be able to pass functions as parameters to other functions, but when I was researching on this I couldn't find any information about this. Is my intuition correct? And if so, how is it done and how do I invoke them afterwards? ...

Showing inherited methods in Squeak/Pharo Smalltalk

I'm familiar with the VisualWorks and Dolphin versions of Smalltalk, but have not previously used Squeak. I'm just familiarising myself with Pharo, which is a 'cleaned up' fork of Squeak. I'm used to having the facility in the Class Browser to show either only the methods implemented by a class or both the methods inherited and the meth...

Constructor not found

I'm trying to implement a new class in Squeak, and for some reason when I run a test I get a MessageNotUnderstood error, even though the message is defined. Class code: Object subclass: #ClassAnalyzer instanceVariableNames: 'theClasses' classVariableNames: '' poolDictionaries: '' category: 'OOP3'! !ClassAnalyzer methodsFor: 'initiali...

Constructors in cases of inheritance (Squeak)

I have a class A which B inherits from. The inheritance includes a bunch of parameters, and they should all be initialized to some default values in both cases (whether we create an A object or a B object). I decided to put the initialization into the constructor of A, since the creation of B should create an A first. However, this doesn...

Get sender of a message in Smalltalk

Is there a practical way to get the sender of a message in Smalltalk without manually passing self as a Parameter? To be more concrete: I want to add a class specific prefix to an ID that gets passed to my class, so if ClassA sends (on class side) ClassB doSomethingWith: 'myId'. ClassB should internally treat 'myId' as 'ClassB-myId' ...