Can someone read Smalltalk? - Page 1
Forum section: electronics / general

author: vlad777
author_rank: Frequent Contributor
timestamp: March 22, 2017, 05:16:10 pm
content: Can you please transcribe what is on the lower right corner on this picture.I can read what is on the left because it is Pascal , but I can't read low res Smalltalk.This is from a video on YouTube.All this is something about using the advantages of collections (although the video goes on about oo design(?) )Many thanks.

author: NivagSwerdna
author_rank: Super Contributor
timestamp: March 22, 2017, 05:25:00 pm
content: create a new bag f. iterates over string, checks it is a letter, adds 1 to element that is of that character. then prints the bag.Try scala instead.

author: tggzzz
author_rank: Super Contributor
timestamp: March 22, 2017, 05:36:28 pm
content: Quote from: NivagSwerdna on March 22, 2017, 05:25:00 pmNot quite. It iterates over the String. If a character is a letter, it adds the lowercase version of the character to the Bag. The Bag is returned.Code:s := Prompter prompt: 'enter line' default: ' '.f := Bag new.s do: [:C| c isLetter ifTrue: [f add: c asLowerCase] ].^fIt is amazing how Smalltalk is an improvement over most of its successors

author: Kalvin
author_rank: Super Contributor
timestamp: March 22, 2017, 05:37:08 pm
content: All three implementation are quite long compared to APL or J.

author: vlad777
author_rank: Frequent Contributor
timestamp: March 22, 2017, 06:15:53 pm
content: What do the bars on top mean (if they are bars/pipes) ?

author: tggzzz
author_rank: Super Contributor
timestamp: March 22, 2017, 06:37:49 pm
content: Quote from: vlad777 on March 22, 2017, 06:15:53 pmIf you mean |s f| then that is simply stating s and f are variables.You would highlight/select a block of text (e.g. |s ... ^f), click, select "execute", which causes the selected text to be compiled, executed, and the result (f in this case) shown in an object browser.If that sounds like what happens in IDEs, you would be right: theyalltook their inspiration from Smalltalk. As did the entire Sun and Macintosh GUIs, of course.Smalltalk also invented the "refactoring browser" - but that was relatively recently in the early 90s.

author: vlad777
author_rank: Frequent Contributor
timestamp: March 22, 2017, 06:41:36 pm
content: I'll put your code in a comment bellow the video.

author: helius
author_rank: Super Contributor
timestamp: March 22, 2017, 06:55:13 pm
content: Quote from: vlad777 on March 22, 2017, 06:15:53 pmThose are local variable declarations.Smalltalk can be confusing out of context, because the source code is not stored in files. It is entered directly into a code browser, for instance, as the implementation of an instance method. So in the screenshot, the name that would be used to call the code is not shown (since it is in the list of the code browser, see below). The Pascal version, by contrast, includes its name: "Program frequency;" You can also execute snippets directly in a text editor, but that doesn't save them for use in other programs.

author: tggzzz
author_rank: Super Contributor
timestamp: March 22, 2017, 07:33:38 pm
content: You can play with Smalltalk in your (web)browser athttps://squeak.js.org/demo/simple.htmlThere isn't a object "Prompter", so the first code line should beCode:s:='Hello world 123 bye'.You will find the required mouse actions a little unusual by today's standards. Usability (and familiarity) has improved, but in the early 80s all the concepts were revolutionary. And I don't use the word "revolutionary" lightly.Now, back to playing with Apple's Smalltalk implementation for the 1MB Fat Mac... Gawd it is sloooooow.

author: vlad777
author_rank: Frequent Contributor
timestamp: March 22, 2017, 08:55:50 pm
content: I can't read that font , it's terrible

author: tggzzz
author_rank: Super Contributor
timestamp: March 22, 2017, 09:19:13 pm
content: Don't forget that when that was first used, it was on a 640*480 screen, and most people has access to fonts that were named after the X*Y resolution, e.g. 5*7, and were whatever the glass TTY manufacturer gave you.That serif font was a revelation, and others are available if you use the menus. Deal with it, and be grateful to the pioneers 😀

author: cncjerry
author_rank: Unknown
timestamp: March 23, 2017, 04:45:37 am
content: I was looking for a smalltalk compiler a while back and maybe someone can recommend one?I've played around with some of the scheme implementations like Pixie Scheme, ISkeme and Ischeme on the ipad. They seemed very limited. For goal seeking programs I generally still use Prolog which goes way, way back. I just used it on the parallel resistor thread last week or so. I wanted to try smalltalk again, we had a language like it at IBM years ago and actually I can't remember which came first, it might have been a precursor to smalltalk, can't remember.

author: tggzzz
author_rank: Super Contributor
timestamp: March 23, 2017, 08:22:09 am
content: Quote from: cncjerry on March 23, 2017, 04:45:37 amI doubt it was a precursor to Smalltalk. The first Smalltalk was Smalltalk-72 used inside Xerox PARC; the first widely released one was Smalltalk-80, and widely publicised in the August 1981 Byte magazine with Tinney's famous balloon cover. Apple's Smalltalk was released in 1985.ISTR there is/was a GNU Smalltalk compiler, but any Smalltalk compiler would be useless; you want a Smalltalk image plus virtual machine. There are many around, and I haven't looked recently to see what's available. If you only want to play around, it isn't going to matter which you choose; if you want to do more then my info is too out of date to be of help.

author: nfmax
author_rank: Super Contributor
timestamp: March 23, 2017, 09:55:55 am
content: You can even try running Smalltalk on a simulated Xerox Alto, using the Contralto simulator:http://www.livingcomputers.org/Discover/News/ContrAlto-A-Xerox-Alto-Emulator.aspx.

author: helius
author_rank: Super Contributor
timestamp: March 23, 2017, 07:07:06 pm
content: Quote from: cncjerry on March 23, 2017, 04:45:37 amhttps://github.com/Cuis-Smalltalk/Cuis-Smalltalkhttp://pharo.orgQuote from: cncjerry on March 23, 2017, 04:45:37 amIBM VisualAge was released in 1995, a little bit later than Smalltalk (originally designed in 1972, and later redesigned in 1980 to be released outside Xerox).

author: gmarentette
author_rank: Newbie
timestamp: March 28, 2017, 01:08:06 pm
content: IBM also sold VisualAge Java which was developed using VisualAge Smalltalk and had an integrated development environment much like VisualAge Smalltalk. It was great for Smalltalk developers like me transitioning to Java, but I guess there weren't enough of us because they killed it after just a few years.

author: cncjerry
author_rank: Unknown
timestamp: March 30, 2017, 02:41:08 pm
content: this was long before VisualAge. It was based on PL/S or PL/1, again, I can't remember which one of those that came first either, probably PL/1 which was Programming Language One. It was used for the OS on the System/3 variants like the 32 and 34. It wasn't much above Assembler. I remember reading microfiche for debugging. Then Smalltalk showed up in like 79 or 80, (at IBM) I know it was prior to when I worked on the PC before it came out. I am probably thinking of something else because I then worked with with VMProlog, which is a language I still use, and a LISP interpreter. I always thought that Smalltalk would be the next and only thing.

author: technix
author_rank: Super Contributor
timestamp: March 30, 2017, 02:54:03 pm
content: Quote from: tggzzz on March 22, 2017, 05:36:28 pmHow about Objective-C with Swift extensions?Code:NSDictionary<NSNumber *, NSNumber *> *count(NSString *string){NSMutableDictionary<NSNumber *, NSNumber *> *counter = [NSMutableDictionary dictionary];for (NSUInteger idx = 0; idx < string.length; idx++){unichar ch = [string characterAtIndex:idx];if (!isalpha(ch)) continue;counter[@(ch)] = @(counter[@(ch)].integerValue + 1);}return counter.copy;}

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 03:01:11 pm
content: Quote from: technix on March 30, 2017, 02:54:03 pmWhile I prefer Objective-C to C++, I don't have any opinion of Swift since I've never used it. I presume that if I ever intended to program for Mac machines, I would use Swift.Remind me; does Swift have adecentgarbage collector, or does it rely heavily on programming Design Patterns to reclaim memory, similar to Apple's Cocoa?

author: technix
author_rank: Super Contributor
timestamp: March 30, 2017, 03:42:40 pm
content: Quote from: tggzzz on March 30, 2017, 03:01:11 pmApple tried to play with a garbage collector but killed it in Mountain Lion (and never brought it to iOS.) Now they use the design pattern combined with compile-time static code analysis to do most of the memory management. The LLVM/clang compiler, when called with -fobjc-arc, will use static code analysis based on the design patterns to insert calls to objc_retain and objc_release for you. You still program as if there is a garbage collector, but the resulting code is somehow the same as old style manual memory management.

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 04:11:21 pm
content: Quote from: technix on March 30, 2017, 03:42:40 pmThat confirms my recollection. Another example where Smalltalk is an improvement on its successors.

author: technix
author_rank: Super Contributor
timestamp: March 30, 2017, 04:44:48 pm
content: Quote from: tggzzz on March 30, 2017, 04:11:21 pmActually to my best knowledge this compile-time static code analysis based approach to memory management is better than any garbage collector. Garbage collectors' behavior can be chaotic based on implementation. This "automatic reference counting" static code analysis method is actually deterministic and you know exactly when, where and how memory management is going to happen. Also you can optionally switch it off for certain parts of the code to optimize the heck out of it.

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 04:51:17 pm
content: Quote from: technix on March 30, 2017, 04:44:48 pmIf you can do static compile-time analysis then, by definition, you neither have nor need a garbage collector.The C-based garbage collectors (e.g. Hans Boehm) get it almost right, most of the time - but have to let the heap silt up because they are conservative. Fundamentally they areguaranteedto be a boneheaded heroic failure, a castle built on sand.

author: technix
author_rank: Super Contributor
timestamp: March 30, 2017, 04:58:45 pm
content: Quote from: tggzzz on March 30, 2017, 04:51:17 pmNow how does Smalltalk perform garbage collection then? So far all modern Smalltalk implementations I have seen borrows the static analysis memory management from Objective-C. (Folks call Objective-C a simple union of Smalltalk and C for a reason)

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 05:30:54 pm
content: Quote from: technix on March 30, 2017, 04:58:45 pmIverymuch doubt that, except possibly w.r.t. objects in an "eden space" that haven't yet become "tenured"! There are many many many GCs, and I don't know which are used in different implementations. There has been continual research and refinement over the past 35 years, but quite frankly the best are now found in Java. Henry Baker made many advances, so did L Peter Deutsch.QuoteIndeed. But GC isn't part of the reason!

author: helius
author_rank: Super Contributor
timestamp: March 30, 2017, 06:32:43 pm
content: Smalltalk is a dynamic language and so static analysis has limited usefulness. The most dramatic example of this is thebecome:message, which makes any two objects change places: all references to one now point to the other and vice-versa. This kind of operation is a problem for attempting to prove what is going to happen, although it isn't the only problem; methods can also be added and removed at runtime.

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 07:20:17 pm
content: Quote from: helius on March 30, 2017, 06:32:43 pmThat's all true and relevant, but the limitations of static analysis are much wider than that.Essentially static analysis of unconstrained programs (e.g. any of the C family) is equivalent to the Halting Problem. And we all know tractable that isn't!Static analysis can help solve a limited subset of problems in well-defined constrained circumstances.

author: helius
author_rank: Super Contributor
timestamp: March 30, 2017, 08:00:51 pm
content: It seems to work fairly well in languages with inferred, parametric types (the ML family)

author: tggzzz
author_rank: Super Contributor
timestamp: March 30, 2017, 09:54:14 pm
content: Quote from: helius on March 30, 2017, 08:00:51 pmNot having used *ML nor Haskell, I don't have a valid opinion. My understanding is that they are specifically designed to enable optimization based on type inferences. I don't understand the constraints nor the consequences. Nonetheless, I presuming they support "objects" in a vaguely Smalltalk sense, I don't see how they can avoid needing a good GC.

author: helius
author_rank: Super Contributor
timestamp: March 30, 2017, 10:57:05 pm
content: If you have a closed-world assumption (which is not possible in a dynamic language without a lot of careful work, c.f. Dylan's "sealing" operation), you can view the execution environment as a kind of DAG that changes at each program step. Whenever a subgraph gets isolated, it is garbage, and you can reclaim its storage at that point. This was called "compile-time garbage collection" in the Concurrent Clean literature. Basically you need to know the input and output types and the side effects of all the functions in the graph. This is also very similar to Henry Baker's "linear lisp" concept as described in his papers.In practice, I don't know if this static approach is really an advantage. With a copying GC, you tend to have better cache locality, although the precise point in the computation when tracing happens is less predictable and can have a major impact.