squeak

How can I easily change to native fonts in Smalltalk Squeak/Pharo

╄→尐↘猪︶ㄣ 提交于 2019-11-30 08:38:28
With every new Squeak/Pharo image, I immediately change the fonts to some native version. It is a lot of mouseclicks and I want to script the process. The above answer might be outdated by now, at least it doesn't work with my 3.10 image. so, I use this: defaultFont := LogicalFont familyName: 'Geneva' pointSize: 10 emphasis:0 . codeFont := LogicalFont familyName: 'Monaco' pointSize: 10 emphasis:0. Preferences setCodeFontTo: codeFont. Preferences setWindowTitleFontTo: defaultFont. Preferences setButtonFontTo: defaultFont. Preferences setListFontTo: defaultFont. Preferences setMenuFontTo:

Variable types in smalltalk

我的梦境 提交于 2019-11-29 15:06:11
I need help understanding the usage and the difference of variables in Smalltalk. What is the difference and the usage of each variable in the given code below? Object subclass: #MyClass instanceVariableNames: 'x' classVariableNames: 'Yy' poolDictionaries: '' category: 'helpMe' MyClass class instanceVariableNames: 'zzz' An instance variable ( x ) is a variable that is local to an instance. Neither the class nor any other instance can access that variable. A class variable ( Yy ) is local to a class, all its instances, all subclasses and all subinstances (so the entire hierarchy). Any subclass

How can I add an item in the World-menu of Pharo 4.0?

给你一囗甜甜゛ 提交于 2019-11-29 07:21:48
How can I add a new item - Workspace openLabel: 'Workspace' - to the World-menu of Pharo 4.0 ? (What can I say... I prefer Workspace over the new what's-it-called. :-) I've looked at several menu-related items in the Browser, but couldn't really make head or tails of it. I also tried to find where the menu is stored (it must be somewhere, right?), but couldn't find it. Also, how would I go about to add it to one of the existing sub-menues of World-menu, and how could I create a new sub-menu (in the World-menu) and add it there? Add the following class method to any class you like. Best to make

Is it possible to extend an individual object in Smalltalk

半城伤御伤魂 提交于 2019-11-29 01:56:36
I'm doing research in Smalltalk reflection, and I was wondering if it was possible to extend an individual object like that would be possible for instance in Ruby. With this I mean a selector that only particular objects respond to. Here is some Ruby code that states what I mean. For clarification: in Ruby this open a virtual class for this object, and extends it with a new definition. The vital part here is that nothing changes to the class definition! o = Object.new o.instance_eval {def foo;puts "foo";end} o.foo #=> "foo" #however this will fail: m = Object.new m.foo #=> NoMethod error More

Why shouldn't I store into literal arrays in Smalltalk?

白昼怎懂夜的黑 提交于 2019-11-28 12:23:59
Some style-guides and idioms suggest that you should not mutate literal arrays, like in this case: MyClass>>incrementedNumbers | numbers | numbers := #( 1 2 3 4 5 6 7 8 ). 1 to: numbers size: do: [:index | numbers at: index put: (numbers at: index) + 1]. ^ numbers Why should I not do that? Tobias Note: The following is implementation dependent. The ANSI Smalltalk Standard defines: It is unspecified whether the values of identical literals are the same or distinct objects. It is also unspecified whether the values of separate evaluations of a particular literal are the same or distinct objects.