Questions tagged [gnu-smalltalk]

GNU Smalltalk is a free implementation of the Smalltalk-80 language. It runs on most POSIX compatible operating systems (including GNU/Linux, of course), as well as under Windows. Smalltalk is a dynamic object-oriented language, well-versed to scripting tasks.

GNU Smalltalk is a free implementation of the Smalltalk-80 language. It runs on most POSIX compatible operating systems (including GNU/Linux, of course), as well as under Windows. Smalltalk is a dynamic object-oriented language, well-versed to scripting tasks.

115 questions
5
votes
3 answers

Smalltalk stdin nextLine for fixed number of lines of input

I am currently trying to get 3 specific lines of input of the form: XX.XX (float) XX (1-3 digit integer) XX (1-3 digit integer) Below is the current code I have: inputStringOne := stdin nextLine. mealCost := inputStringOne. Transcript show:…
qxzsilver
  • 522
  • 1
  • 6
  • 21
5
votes
2 answers

When is initialize invoked in smalltalk?

I have a class with instance variable 'a'. When i create a new instance of the class using new, what is the order of the methods that are called? How will the object know that it should call the initialize method? If I create a class method to…
Aditya Kappagantula
  • 564
  • 1
  • 7
  • 21
5
votes
1 answer

Developing UI's in GNU/Smalltalk

Which frameworks or packages exists for developing UI's with GNU/Smalltalk? There seems to be a GTK+ binding but not much documentation about it. For example in VisualAge Smalltalk there is WidgetKit and in Squeak there is Morphic with Announcements…
user183928
  • 783
  • 3
  • 9
5
votes
1 answer

Why GNU Smalltalk uses brackets for method bodies?

In GNU Smalltalk manual it is written that: Unlike other Smalltalks, method statements are inside brackets. So I'm wondering, why there would be such an arbitrary deviation from Smalltalk-80?
Vladimir Keleshev
  • 13,753
  • 17
  • 64
  • 93
5
votes
3 answers

Defining methods with double greater than sign (>>) in Smalltalk

In the book Smalltalk Best Practice Patterns from Kent Beck, the double greater sign (>>) is used to define methods like this: Point class>>x: xNumber y: yNumber ^self new setX: xNumber y: yNumber Point>>setX: xNumber y:…
Domon
  • 6,753
  • 1
  • 25
  • 29
4
votes
1 answer

Is there a specific way to get the Ip of a computer in Pharo smalltalk?

I am trying to run an application Pharo that requires data from the Ip of the host computer in which it's running. In general I have to open the code to set it manually in my Pharo code then launch the application. Is there a better and…
ludo
  • 543
  • 3
  • 14
4
votes
2 answers

Smalltalk syntax highlighting in Sublime?

I'm trying to get sublime to highlight smalltalk .st files but am running into some trouble. A quick search found this package, but after adding the repository like it says in the README, I don't see the package that its supposed to add when doing…
MarksCode
  • 8,074
  • 15
  • 64
  • 133
4
votes
1 answer

Is it possible to manually exit out of Smalltalk vm with return code?

Basically, is there some kind of analogue of exit(-1) function in GNU Smalltalk 3.2.5? Or is there a way to configure it so that if it encounters an error during execution it'd return non-zero exit code? I want to be able to detect if gst executed…
Dan M.
  • 3,818
  • 1
  • 23
  • 41
4
votes
1 answer

Extending default classes (SmallInteger)

I'm trying to extend the SmallInteger class with a new instance method "square". The idea is I wanna be able to call "5 square" and it'll return 25. Extending your own classes with instance methods is fairly simple, since you know the variable…
Mossmyr
  • 909
  • 2
  • 10
  • 26
4
votes
3 answers

Variable types in smalltalk

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' …
2Big2BeSmall
  • 1,348
  • 3
  • 20
  • 40
4
votes
5 answers

Smalltalk Fibonacci

I have to use Smalltalk to return the nth Fibonacci number, I haven't used this language before. This program returns 1 to any input and I don't know why. It didn't even iterate the for loop I think. Could someone help me? Thanks. 'Which fibonacci…
szab.kel
  • 2,356
  • 5
  • 40
  • 74
3
votes
1 answer

How to explore a namespace in gnu smalltalk

When using gnu smalltalk (without emacs integration) what commands/process does one use to explore the contents of a namespace ? For example, I want to find out how to use the contents of NetClients but if I just type NetClients examine I get an…
user467257
  • 1,714
  • 1
  • 16
  • 19
3
votes
1 answer

Why is assigning many variables seem to mutate my variable?

I'm new to Smalltalk so I don't know if I'm doing something wrong but this seems very weird and buggy. dict := Dictionary new. dict at: 1 put: 1. dict at: 2 put: 2. dict at: 3 put: 3. dict at: 4 put: 4. 1 to: 4 do: [:j | key := j. value :=…
Axnyff
  • 9,213
  • 4
  • 33
  • 37
3
votes
1 answer

Binary Search in smalltalk

Array extend [ Array class >> bin: val left: l right: r [ ^ super binSearch: val left: l right: r ] binSearch: val left: l right: r [ |arr iter| arr := self. [l == r] ifTrue: [^ (-1)]. iter := (r +…
Nathan Takemori
  • 139
  • 1
  • 10
3
votes
1 answer

GNU Smalltalk image save state

Working thro the guide making a new class. I can make a new or load an image file (.im) using gst command. I type in the code to make a Account class and can make a new class. Question How do I save the class to the loaded image before closing gst…
Firefly
  • 79
  • 5