pharo

How to change the font in the SpTextPresenter?

岁酱吖の 提交于 2021-01-27 17:02:19
问题 Pharo 9, Spec 2 -- I have a Spec 2 presenter with a text widget: initializePresenters text := self newText. super initializePresenters As I understand its type is SpTextPresenter . How to change the font of this text ? Font face, size of the all shown text in this widget... For example, to "Courier New", 9. EDIT 1 : Also I tried: text addStyle: { SpStyleSTONReader fromString: ' Font { #name: "Source Sans Pro", #size: 12, #bold: false, #italic: true }' }. but it does not work, the error is:

Smalltalk (Pharo) How to interface with the user simply

南笙酒味 提交于 2021-01-21 08:29:35
问题 I stumbled upon Smalltalk and further downloaded Pharo, because it was recommended. My first impression is very positive. I wanted to port some simple programs I have written in C++ (my main language), so I can get a feel for Smalltalk. However, I realized I can't find a simple way to just get some input from the user, e.g. I want to create a console calculator with a REPL loop, but I can't find a way to do this in Pharo. I don't want a gui with buttons, because that is just slow and

Smalltalk: Can a single object block the entire system by entering an infinite loop?

随声附和 提交于 2021-01-04 07:23:49
问题 Since Smalltalk scheduling is non-preemptive, processes must explicitly yield or wait on a semaphore Does this mean that one object entering an infinite loop could stall the entire system? the loop can be interrupted at any time. Even an atomic loop like [true] whileTrue can be interrupted before "executing" the true object By what can it be interrupted? 回答1: It is the Virtual Machine who may interrupt the image. Under a normal execution flow, the VM is basically sending messages, one after

Smalltalk: Can a single object block the entire system by entering an infinite loop?

眉间皱痕 提交于 2021-01-04 07:23:06
问题 Since Smalltalk scheduling is non-preemptive, processes must explicitly yield or wait on a semaphore Does this mean that one object entering an infinite loop could stall the entire system? the loop can be interrupted at any time. Even an atomic loop like [true] whileTrue can be interrupted before "executing" the true object By what can it be interrupted? 回答1: It is the Virtual Machine who may interrupt the image. Under a normal execution flow, the VM is basically sending messages, one after

Hacker News 简讯 2020-07-21

好久不见. 提交于 2020-08-14 03:28:33
更新时间: 2020-07-21 23:00 AMD Launches 12 Desktop Renoir Ryzen 4000G Series APUs: But You Can’t Buy Them - (anandtech.com) AMD推出12台雷诺阿雷森4000克系列台式机:但你不能买 得分:46 | 评论:31 Common mistakes writing React components with hooks - (lorenzweiss.de) 书写常见错误用钩子反应组件 得分:65 | 评论:38 Monitoring your own infrastructure using Grafana, InfluxDB, and CollectD - (serhack.me) 使用Grafana、InfluxDB和CollectD监控您自己的基础架构 得分:114 | 评论:78 Invert, Always, Invert - (anup.io) 反转,总是,反转 得分:234 | 评论:64 Systems Design for Advanced Beginners - (robertheaton.com) 面向高级初学者的系统设计 得分:650 | 评论:73 AI in physics: are we facing a scientific

How does the organisation of classes in categories and packages work in different versions of Pharo?

故事扮演 提交于 2020-02-01 04:05:08
问题 Can someone explain how the organisation of classes in Pharo works in different versions of Pharo? All Classes are part of the Smalltalk global (have always been, seem to stay like this?) Classes can have a Category, but thats only a kind of tag? (has always been, seems to stay like this? But the categories are somehow mapped to packages sometimes ?) There are different kinds of Packages in different Versions of Pharo MCPackages representing Monticello Packages PackageInfo RPackage (Pharo 1.4

Pharo Smalltalk - Message forwarding, is it possible to intercept a message and redirect it to another Object (instance)?

99封情书 提交于 2020-01-24 18:24:07
问题 Pharo Smalltalk - Message forwarding, is it possible to intercept a message and redirect it to another Object (instance)? In Objective-C there's forwardInvocation: that gets called right before an exception is thrown so you can do something about the message you received and know nothing about. Is there something similar in Smalltalk do I can redirect a message to a delegate? 回答1: Smalltalk has doesNotUnderstand: aMessage which is sent to the receiver in place of an otherwise undefined method

Double dispatch in Pharo

杀马特。学长 韩版系。学妹 提交于 2020-01-22 19:45:08
问题 Could someone please explain the process of double dispatch in Pharo 4.0 with Smalltalk? I am new to Smalltalk and am having difficulty grasping the concept, since it is implemented very differently in Java as compared to Smalltalk. It will be very helpful if some one could explain it with an example. 回答1: Essentially the idea is that you have method: #addInteger: which knows how to add integers, #addFloat: which knows how to add floats, and so on… Now in Integer class you define + as: +

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

Pharo SubscriptOutOfBounds:5 error

坚强是说给别人听的谎言 提交于 2020-01-16 16:29:07
问题 I have a Pharo extension that adds promises to Pharo Smalltalk. I then use the promise extension to do a bank transfer with the following bank application.An account contacts the bank in order to transfer money to another account. This code fails with the error SubscriptOutOfBounds:5 . I looked at Recursive method in pharo produces #SubscriptOutOfBounds:8. It talks about array bounds but I have no clue where I could be using arrays in my implementation unless the stack does.The debugger says