Questions tagged [smalltalk]

Smalltalk is one of the oldest object-oriented programming languages. It pioneered many aspects modern developers take for granted: Virtual Machines (Smalltalk is an interpreted language) IDEs Pure object approach (no primitives or keywords at all) Closures (called Blocks) An image (i.e. non-file-based language) Advanced debugging techniques (halting programs on-the-fly, inspection, writing or modifying code on-the-fly)

Filter by
Sorted by
Tagged with
0 votes
3 answers
46 views

Understanding Smalltalk Method Invocation with Multiple Colons

I'm currently learning Smalltalk, and I've encountered a behavior that I find puzzling regarding method invocation with multiple colons. I understand that colons play a crucial role in specifying ...
Ofir's user avatar
  • 100
1 vote
1 answer
42 views

Convert DateTime to formated String on Pharo 11

DateAndTime now asString returns a string in a format like YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z Is it possible to create a String based on a DateTime but with a different format?
VitorCruz's user avatar
  • 392
5 votes
1 answer
95 views

Is there a function to check intersection of two timespans in smalltalk?

Is there a built-in function in smalltalk that takes as input two timespans, and checks whether they intersect? As an example: the two timespans 2018/01/01-2018/01/05 and 2018/01/03-2018/01/10 do ...
magnolia93's user avatar
0 votes
2 answers
53 views

smalltalk difference new & initialise

I have the following three snippets of code (run in Pharo), where I would like to understand why and how the following does (not) work to understand new and initialise a := Point initialize. this does ...
magnolia93's user avatar
1 vote
2 answers
62 views

Sort array that has different types in smalltalk

I tried to run this code to sort an array and got this error | x sortedX | x := #('bb' 10 'aa' 2 'cc' 3 5). sortedX := x asSortedCollection: [:y :z | (y class = z class) ifTrue: [y < z] ...
yoav28's user avatar
  • 28
4 votes
1 answer
119 views

Singleton pattern for multi-processing on Pharo 10.0 ( Smalltalk )

I can't pass the test below. "SingletonTest" testCurrent | semaphore object1 object2 | Singleton initialize. semaphore := Semaphore new. [ Processor yield. ...
Yuji Hamaguchi's user avatar
5 votes
1 answer
110 views

Which methods must I override to enable drag&drop in Squeak?

I have a big morph with dozens of submorphs. The submorphs are of two kinds: pieces and squares. I have googled a lot and read quite a bit of Morphic documentation, but somehow I can’t get it to work. ...
Sander de Jong's user avatar
1 vote
1 answer
72 views

Refreshing a Morph without any user interaction

I am creating a board game that can have both human and bot players. My first version, which uses the Transcript, is ready. So now I want to make a better looking, more user friendly version using ...
Sander de Jong's user avatar
1 vote
1 answer
70 views

Queries regarding Smalktalk's method and class

You can't have methods with the same name in the same class in Smalltalk. Why? I don't understand why methods can't have same name in same class.
Jaima Shahira's user avatar
3 votes
3 answers
149 views

How is ordered a Dictionary in Pharo?

Let's say we have a loop that enters Associations to a Dictionary in a clear order: | d | d := Dictionary new: 10. 1 to: 10 do: [ :i | d add: i -> (i + 9 printStringBase: 20) ]. d When I ...
siery's user avatar
  • 484
2 votes
1 answer
105 views

Smalltalk Prime Generator with a connected list not working

Been trying to debug this code for a while but I can't seem to understand the problem at hand. The program that I'm making is a Smalltalk program that has to use a connected list with nodes to ...
GearedInsanity's user avatar
2 votes
1 answer
78 views

Smalltalk anomaly - why are the variables always the same, but when computing booleans they are different?

I chose to try out Smalltalk for AOC 2022 puzzle 4. I'm predicating on each line and increment the counter if the constraints are met. I'm trying to understand why the '2-8,3-7' line doesn't met the ...
Edvin Sinkevič's user avatar
2 votes
1 answer
123 views

Stream assigment in pharo

I have a problem here. I have a data variable of type an OrderedCollection. this variable shows me this when I do a DoIt: an OrderedCollection ('3c7lwmdva2b8jbt39ls4pz3sl' '3c7lwmbf36tamw1m45riirdze' ...
Mansour Faouziel's user avatar
1 vote
2 answers
141 views

Generateing a method via source code in pharo

My goal is to generate a test method (automatically if we can say so). To do this, I need to send to a method that I named writeTestMethod., two parameters: the method I want to generate its test ...
Mansour Faouziel's user avatar
1 vote
0 answers
75 views

Generate test method with their body in pharo

I advanced a little in my code but I find myself facing another problem for two days. I would like to generate a test method using only the source code. But I have no idea how to do it. I have a ...
Mansour Faouziel's user avatar
0 votes
1 answer
85 views

Class Test generate in Pharo via source code

I have a problem with my pharo code. I would like to generate a test class via the source code and that this class is visible in the packages of the browser system. But I don't know why it doesn't ...
Mansour Faouziel's user avatar
2 votes
1 answer
157 views

initialize with pharo smalltalk

Here is a description of my problem. I have a Person class which has three attributes: lastname, name and birthDate. Object subclass: #Person instanceVariableNames: 'name lastName birthDate' ...
Mansour Faouziel's user avatar
0 votes
1 answer
91 views

deleting a collection completely in smalltalk

I want to delete a collection in smalltalk so when the user selects the option again it is newly created. This is my code: "opcion 7" /opc = 7) ifTrue: [ masDeUno:= ...
D B's user avatar
  • 3
-1 votes
2 answers
155 views

Pharo dictionary

I have an issue and this is the result when i call one method in my code. t do:[:i | dict := Dictionary newFrom:{t->items}. ]. t is an OrderedCollection(#name #lastName #birthDate) ...
Mansour Faouziel's user avatar
0 votes
1 answer
153 views

Pharo initialize an object with an OrderedCollection

Indeed it is within the framework of a research. I'm trying to generate random values ​​for the instance variables of an X object. So when instantiating the object, I replace the parameters of the ...
Mansour Faouziel's user avatar
0 votes
1 answer
122 views

Pharo get all setter from a class

I am new in pharo. I have a problem. I want to get all setter from a class in this language. But i don't any idea for do that. For example, we have ClassA that have a method like: Object SubClass: #...
Mansour Faouziel's user avatar
-2 votes
1 answer
258 views

How does rounded function work in Smalltalk?

How do I round a decimal by thousandths(3 decimal places) in Smalltalk. Code: rounded "Answer an Integer nearest to receiver" ^(self + (self sign * 0.5)) truncated Caller: ...
lahari chinthapula's user avatar
0 votes
1 answer
94 views

Convert Decimal number to Binary in Pharo

I'm trying to Convert a decimal number into binary using Pharo, but I'm having trouble with the recursive message. I figured I could do string concatenation of the values so that when I gave it the ...
decabytes's user avatar
  • 386
1 vote
2 answers
145 views

Smalltalk question about genetic distance

In my homework i received a question on how to code generic distance in smalltalk. in Smalltalk a genetic distance between classes (new thing) is the amount of minimal father steps or son steps that ...
Amazing programmer's user avatar
2 votes
1 answer
242 views

How to open a smalltalk image in squeak?

Super noob question here. Seems basic but I'm not understanding how to do this. Someone sent me a smalltalk program "program.app" and now I want to open it and run it in squeak. How do I do ...
Yume's user avatar
  • 426
0 votes
0 answers
547 views

AWS EC2 running a server on 8080 but cannot connect from outside

Here is a shot of my inbound rules I should be able to connect using the domain that is up and running so I can get the index page at http://www.marblecake.net but I can't get my server at http://www....
LongHairedDavid's user avatar
4 votes
1 answer
86 views

Seaside redirect for render not working on physical iOS devices

We're having a problem with physical iOS devices (works fine on Chrome virtual device) where a final Seaside redirect is not happening after an Azure SSO redirect. I'd like to understand what triggers ...
Bob Nemec's user avatar
  • 366
4 votes
2 answers
83 views

Is there an equivalent to #implementedBySubclass in Java?

I have a design question. I have a class hierarchy: AbstractEntity NPC extends AbstractEntity implements LifeForm Player extends AbstractEntity implements LifeForm There is a method #moveTo(Target ...
Snorik's user avatar
  • 201
6 votes
2 answers
174 views

Is it possible to make a multiple-window GUI in Squeak?

In Squeak, is it possible for a GUI program to have multiple windows? For example, if I am making a painting application, is it possible for the "paint palette" and the "canvas" to ...
Flux's user avatar
  • 10.1k
2 votes
2 answers
110 views

Display array of objects as a table

I have an array of Candle objects as shown below: Is there a way in Pharo to display the array in a tabular format? | date | open | high | low | close | |------------+------+------+-----+-------...
dharmatech's user avatar
  • 9,129
4 votes
3 answers
200 views

How do I start Etoys from Squeak?

In the Squeak System Browser, I see that there are many class categories related to Etoys: But how do I access Etoys from Squeak? How do I get something like the screenshot shown below? (Source of ...
Flux's user avatar
  • 10.1k
2 votes
1 answer
104 views

How to disable access to development environment when releasing a GUI application

I have made a GUI application using Squeak, which I want to make available to the public without them necessarily knowing that the program was made using Squeak. I want to disable all the Smalltalk ...
Flux's user avatar
  • 10.1k
3 votes
1 answer
96 views

smalltalk: about method- "withArgs:executeMethod:"

I'm trying to understand the method "withArgs: executeMethod: " in smalltalk, squeak. 1. I am trying to understand what is the role of the method? 2. What arguments need to be passed to it ...
moran's user avatar
  • 31
1 vote
1 answer
86 views

What does # stand for in Smalltalk

hi im unsure what # stand for in samlltalk and can't find a definition. exercise code sample: ('hello','world')== #helloworld I need to find out if this is true or false. I think its false because &...
base's user avatar
  • 83
5 votes
2 answers
171 views

Cannot understand how incremental assemblers/compilers/image-based systems work

I am learning a little assembly and for my next project I would like to learn how to make an incremental assembler. By "incremental assembler" I mean an assembler that accepts new code while ...
Zwanzika Hatzel's user avatar
0 votes
1 answer
277 views

How to close / delete a Morph in Squeak?

Let's say I have a new Morph: m := Morph new. m openInWorld. How do I close / delete the Morph off? m removeFromWorld.
avivgood2's user avatar
  • 227
2 votes
1 answer
80 views

Spec - How to edit the contents of a table in place

I have an SpTablePresenter and I would like to edit the cell contents. In many frameworks it is possible to edit the contents of a table directly in place, without needing to open a new component (...
EstebanLM's user avatar
  • 4,297
3 votes
1 answer
80 views

How to use a -Manifest package in Pharo Smalltalk after File-in/Install?

I just upgraded to the newest version of Pharo Smalltalk. Before doing so, I "File-outed" a package from my old version called My-Pharo - a package I use for various configurations and ...
Baard Kopperud's user avatar
0 votes
1 answer
48 views

Code for #into: is related to the code for #inject:into: , but must be solving a different problem. Explain the difference?

What does this do, and is there a simpler way to write it? Collection>>into: a2block | all pair | all := ([:allIn :each| allIn key key: allIn value. each]) -> (pair := nil -...
Jim Sawyer's user avatar
3 votes
2 answers
105 views

how to simplify smalltalk expression by using as less brackets as possible

im new to smalltalk. I and in my online course I got the exercise task to simplify an expreesion: ((7 + 5) + (31 * 8) - (51 * 2)) I tried different things out but to be honest I dont understand the ...
moki's user avatar
  • 41
3 votes
2 answers
423 views

how to write string literal with new lines in Pharo

How do you write a string literal with new line characters in Pharo 9? I tried the following but neither of them inserted the new line: a := 'paragraph1\n\nparagraph2'. a := 'paragraph1\\n\\...
cts's user avatar
  • 1,790
1 vote
2 answers
175 views

Pharo Smalltalk Method Execution

I have a few test cases that I need to write a method for, and how they execute the method is like this: Planets with: aString , anotherString Where "Planets" is a class and "with:&...
Cheetos's user avatar
  • 17
4 votes
2 answers
89 views

Pharo: #( $H $e $l $l $o ).'Hello' has no example in Finder

When I go to the finder and select "Examples" then I can't figure out how to find a method that turns #( $H $e $l $l $o ). into 'Hello'. Nor does MethodFinder new findMethodsByExampleInput: #...
Melvin Roest's user avatar
  • 1,402
2 votes
1 answer
46 views

Spec - use ctrl-S (or cmd+s) to save text entry

is there a way in SpTextPresenter and SpTextInputFieldPresenter to use ctrl+S (or cmd+S in mac) to save text entry? Old pharo components (notably old spec but this comes since before, when components ...
EstebanLM's user avatar
  • 4,297
3 votes
3 answers
96 views

Smalltalk Seaside display in threes without using tables

I have built a web site for my local plastic model club which involves showing multiple images on a page. I like to show them 3 abreast. Up to now, I have done this using a nested series of table ...
LongHairedDavid's user avatar
1 vote
1 answer
123 views

What does A=B (B [:,])*! mean in Cincom Smalltalk [closed]

I'm new to Smalltalk and now using Antlr to parse Cincom Smalltalk code. There is only a very short piece of code within <body ...> and </body>, but I couldn't parse it and couldn't find ...
Aaron Wang's user avatar
3 votes
1 answer
141 views

Spec - how to change the color (or background color) of a presenter

I want to change the background color of a SpTextInputFieldPresenter e.g. to provide a visual feedback of the input, I want to react to whenTextChangedDo: and change the background color of the field ...
EstebanLM's user avatar
  • 4,297
1 vote
1 answer
134 views

Adding Categories to Classes in Pharo 9.0 (Smalltalk)

I've very recently started learning Pharo Smalltalk and my first assignment requires me to add three categories to a class, but the problem is that any information I find on the web is written before ...
AppleJuice's user avatar
3 votes
1 answer
129 views

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 ...
user467257's user avatar
  • 1,722
2 votes
1 answer
54 views

Spec - how to update a tree list keeping current selection?

I am displaying a tree and I need to add an element, but I want to keep the currently selected item. If I do it like this: oldSelectedItem := treePresenter selectedItem. treePresenter roots: ...
EstebanLM's user avatar
  • 4,297

1
2 3 4 5
34