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
2
votes
1 answer

How to use text file as input to feed in the interactive input of smalltalk and redirect output to a file

I am struggling to find out is there a way to feed input to the interactive command of gst a.st b.st ... - and redirect the output. Normally, the interactive buffer will have st> ... and when you type a command it will output something by…
ddttdd
  • 111
  • 1
  • 6
2
votes
1 answer

How to look at image code in GNU Smalltalk?

how can I look at class / message code from within the GST command line interface? I only know the #inspect message, but this shows only a definition or summary of the object, not the code. Thank you :-)
Marc
  • 585
  • 5
  • 19
2
votes
1 answer

Smalltalk - iterate over a dict array with conditions

I'm working on a Smalltalk small method, I want this method to iterate over a dictionary array and to return True or False depend on the conditions. The dictionary array is an instance variable, name dictArray. It looks like: [{'name': toto, 'age':…
2
votes
3 answers

GNU Smalltalk: Problem with Example in Tutorial (Object creation)

I tried to run the example of GNU Smalltalk in the documentation but ran into an issue. Object subclass: Account [ | balance | new [ | r | r := super new. r init. ^r ] init [ 'initialize account' printNl. balance :=…
user524824
2
votes
1 answer

Why this block is not trimming string

I am trying following block to trim leading spaces from the sent string: trimleading := [ :str| ch := (str byteAt: 1). "get first character: ERROR HERE" ret := str copyFrom: 1. "make a copy of sent string" [ch = ' ']…
rnso
  • 23,686
  • 25
  • 112
  • 234
2
votes
1 answer

Why first line of file not being read here

I am trying following code to read and print first line of all files with extension .st in directory: (Directory working: '.') allFilesMatching: '*.st' do: [ :ff | line := (ff nextLine). "Read first line only." line displayNl. ff…
rnso
  • 23,686
  • 25
  • 112
  • 234
2
votes
1 answer

Why this class/instance variable is not being intialized?

I am trying to use gnu-smalltalk. In following code of a simple class with a variable, I find it is not getting initialized to the given value: Object subclass: Myclass[ |mainval| mainval := 555. getmainval [^mainval] ] gc := Myclass…
rnso
  • 23,686
  • 25
  • 112
  • 234
2
votes
2 answers

How to add same method with 2 different names in GNU Smalltalk?

How can I have a class expose the same method with 2 different names? E.g. that the asDescripton function does the same thing / re-exports the asString function without simply copy-pasting the code. Object subclass: Element [ | width height | …
adius
  • 13,685
  • 7
  • 45
  • 46
2
votes
1 answer

gst-browser fails to start

I have just installed gst-browser (VisualGST) through the Canonical Ubuntu repositories, so I tried to start VisualGST by running gst-browser on the command line. However, I am immediately greeted with an error: a Smalltalk Stream:2: Abandon a…
Flux
  • 9,805
  • 5
  • 46
  • 92
2
votes
2 answers

GNU Smalltalk - Break from whileTrue loop without return

What is a simple and concise way to break from a whileTrue loop in GNU Smalltalk that doesn't require returning? Here is my code. I want to break from the loop at Line 31 at the end if char_stack is…
SYZYGY-DEV 333
  • 145
  • 1
  • 2
  • 13
2
votes
1 answer

How to have an instance variable that is an array

I would like to create a smalltalk application with a class that has an instance variable that is an array and an instance variable that is the array's size. I would ideally like to initialise these when the object gets created but I have these…
Keagansed
  • 183
  • 1
  • 1
  • 13
2
votes
1 answer

Access message documentation in Smalltalk

When you define a class in Smalltalk, you can acces the documentation comment like this: st> Integer comment 'I am the abstract integer class of the GNU Smalltalk system. My subclasses'' instances can represent signed integers of various sizes (a…
anquegi
  • 11,125
  • 4
  • 51
  • 67
2
votes
1 answer

GNU Smalltalk Object doesn't understand init

I have just started learning GNU Smalltalk from this page. My question is if this page is outdated? In the class creation example it has the r := super new. ^r init massage, however running Object new init i get Object: Object new…
user4813927
2
votes
3 answers

reading smalltalk code from gst prompt

This is simple GNU Smalltalk question. Sorry, but just could not find how to do this. I'm playing with gnu smalltalk, I know I can do % gst but if I already in gst> prompt, how can I read a file into memory (file that contains code),…
eran
  • 6,731
  • 6
  • 35
  • 52
2
votes
1 answer

How to use a multiple line input to create my game?

So, i have one method that will create all of the instance variables for my other methods that will create the game, i know how to do them separately but finding how to do it from one method is really hard. I need to be reading data from a String…
lookorange
  • 31
  • 4