smalltalk

What is the Smalltalk equivalent of Java's static?

℡╲_俬逩灬. 提交于 2019-11-29 09:47:54
What is the Smalltalk equivalent of Java's static fields and methods? IOW, what do the Smalltalkers do when they need class level data and/or methods? We use class-side methods/instance variables. A class is an object, after all, so can have methods. For instance, the Rectangle class has a method #origin:corner: so you may write Rectangle origin: 0@0 corner: 100@100 to create a Rectangle. This is just the message #origin:corner: sent to the object called Rectangle (a class is an object!) with the two Points as parameters. Class-side instance variables work much the same way. A class, being an

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

Best way to start with smalltalk in a windows environment (win 7) [closed]

心已入冬 提交于 2019-11-29 00:52:24
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I am a c# developer and most of my friends are much smarter than me, and they laugh at me and start to swear at me in smalltalk. I

Why is smalltalk not a functional programming language?

我怕爱的太早我们不能终老 提交于 2019-11-28 18:46:52
With the renewed interest in functional programming languages, I've seen some similitudes between Smalltalk and FPL, namely closures ( BlockClosures in Smalltalk ) Yet, Smalltalk is not a FPL? What would be needed to consider it as such? Programming with the Object Oriented paradigm is creating a program by identifying and modeling the Problem Domain Entities as objects, and then make them collaborate between themselves to solve each problem instance. Programming with the Functional paradigm is modeling the problem as a mathematical problem, and creating a mathematical function (by composing

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.

详解Objective-C runtime

≡放荡痞女 提交于 2019-11-27 15:59:38
原文地址: http://blog.securemacprogramming.com/2013/12/by-your-_cmd/ 感谢翻译小组成员 wingpan 热心翻译。本篇文章是我们每周推荐优秀国外的技术类文章的其中一篇。如果您有不错的原创或译文,欢迎提交给我们,更欢迎其他朋友加入我们的翻译小组(联系qq:2408167315)。 本文是我在 Alt Tech Talks: London 上关于 Objective-C runtime的演讲总结,如果你对Objective-C runtime感兴趣的话,应该看看这篇文章,特别是文章中的链接,一定会受益匪浅。 什么是Objective-C runtime? 简单来说,Objective-C runtime是一个实现Objective-C语言的C库。对象可以用C语言中的结构体表示,而方法(methods)可以用C函数实现。事实上,他们 差不多也是这么干了,另外再加上了一些额外的特性。这些结构体和函数被runtime函数封装后,Objective-C程序员可以在程序运行时创建,检 查,修改类,对象和它们的方法。 除了封装,Objective-C runtime库也负责找出方法的最终执行代码。当程序执行[object doSomething]时,不会直接找到方法并调用。相反,一条消息(message)会发送给对象(在这儿

Early binding vs. late binding: what are the comparative benefits and disadvantages?

断了今生、忘了曾经 提交于 2019-11-27 14:37:44
When discussing the evolution of computer languages, Alan Kay says that the single most important attribute of his Smalltalk is late binding; it gives the language its malleability and extensibility, and allows inappropriate coupling to be refactored out over time. Do you agree? Are there compensating advantages for early binding that explain why it seems to be the dominant of the two paradigms for domains where either could be used? My personal experience (which is not broad or deep enough to be authoritative), based on implement web applications with javascript, jQuery, jsext, actionscript,

Early binding vs. late binding: what are the comparative benefits and disadvantages?

拥有回忆 提交于 2019-11-26 22:23:57
问题 When discussing the evolution of computer languages, Alan Kay says that the single most important attribute of his Smalltalk is late binding; it gives the language its malleability and extensibility, and allows inappropriate coupling to be refactored out over time. Do you agree? Are there compensating advantages for early binding that explain why it seems to be the dominant of the two paradigms for domains where either could be used? My personal experience (which is not broad or deep enough

Smalltalk

左心房为你撑大大i 提交于 2019-11-26 18:59:41
  在Smalltalk中所有的东西都是对象,或者应该被当作对象处理。   例如下面的表达式:   2 + 3   应当被理解为:向对象2发送消息+,参数为对象3。   (15 * 19) + (37 squared)   可以理解为:向15发送消息'*',参数为19;向37发送消息squared; 最后向15*19的结果发送消息'+',参数为37 squared的结果。 转载于:https://www.cnblogs.com/hubj/archive/2011/05/04/2036459.html 来源: https://blog.csdn.net/weixin_30897233/article/details/99042783