squeak

Drawing A Rectangle in Smalltalk Squeak

我的梦境 提交于 2020-02-04 04:08:49
问题 given two integer variables 'a' and 'b' in a rectangle class, how do you draw a rectangle? I'm new to smalltalk and im studying it for a course. thanks! 回答1: Squeak uses Morphic as its default UI. So the simplest thing would be to create a Morph : RectangleMorph new extent: 300@200; openInWorld Evaluate all three lines at once. This creates a new RectangleMorph instance, sets its extent to a Point created from 300 and 200 (by sending the message @ to 300 with an argument of 200 ), and also

method that accepts a block and the block accepts an argument

落花浮王杯 提交于 2020-01-25 15:51:20
问题 How can I send a block and its argument to a method ? so the method receive the block and the block receives the argument and I run the block in the method iteslf... 回答1: Just pass the block and its argument to the method as separate arguments. Then send #value: to the block to pass the argument to the block. E.g. methodTaking: aBlock and: anArgument aBlock value: anArgument. ... 回答2: For an example have a look at the sort: method of OrderedCollection (you'll find the block evaluated finally

method that accepts a block and the block accepts an argument

淺唱寂寞╮ 提交于 2020-01-25 15:50:57
问题 How can I send a block and its argument to a method ? so the method receive the block and the block receives the argument and I run the block in the method iteslf... 回答1: Just pass the block and its argument to the method as separate arguments. Then send #value: to the block to pass the argument to the block. E.g. methodTaking: aBlock and: anArgument aBlock value: anArgument. ... 回答2: For an example have a look at the sort: method of OrderedCollection (you'll find the block evaluated finally

Invoking shell commands from Squeak or Pharo

▼魔方 西西 提交于 2020-01-21 01:41:50
问题 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 commands? 回答1: In Squeak you can use CommandShell, but I don't know what (if anything) is available for Pharo at this time. 回答2: I think you can use the package

Getting the new Squeak 5 to run on 64 bit Linux

余生颓废 提交于 2020-01-14 05:32:29
问题 In short: how do I get Squeak 5 to run on x64 Linux? I dont care whether the executable is 32 or 64 bit as long as it runs and opens the Squeak 5 image. Here is what I tried: When I try to run the executables from the Squeak 5 package i get: Running 32-bit Squeak on a 64-bit System. install-libs32 may install them - tried that. Wasn't found. Then I went looking for a 64 bit executable. There are some from Squeak 4 but they can't open Squeak 5 images. Looking through the Squeak 5 package: The

How can I get all the methods in a Protocol?

一笑奈何 提交于 2020-01-12 15:09:08
问题 How can I get a collection of all the (class) methods in a given protocol in smalltalk/squeak/pharo? I'm trying to collect the values returned by a group of methods. I don't want to have to store the methods in an instance or class variable. So I though I could add them to a protocol and in this way to "mark" them. Thanks. 回答1: In Pharo, the method you're looking for is ClassDescription>>allMethodsInCategory: : | selectors | selectors := MyClass allMethodsInCategory: #'protocol name'. To find

How can I get all the methods in a Protocol?

青春壹個敷衍的年華 提交于 2020-01-12 15:07:21
问题 How can I get a collection of all the (class) methods in a given protocol in smalltalk/squeak/pharo? I'm trying to collect the values returned by a group of methods. I don't want to have to store the methods in an instance or class variable. So I though I could add them to a protocol and in this way to "mark" them. Thanks. 回答1: In Pharo, the method you're looking for is ClassDescription>>allMethodsInCategory: : | selectors | selectors := MyClass allMethodsInCategory: #'protocol name'. To find

Create from scratch, or build up on Scratch?

﹥>﹥吖頭↗ 提交于 2020-01-01 12:11:28
问题 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. Scratches source is available under its own free license. It is written in Squeak (based on Smalltalk), and I don't know the language. It occurs to me there might be

Create from scratch, or build up on Scratch?

大憨熊 提交于 2020-01-01 12:11:20
问题 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. Scratches source is available under its own free license. It is written in Squeak (based on Smalltalk), and I don't know the language. It occurs to me there might be