Stephen Compall's blog

Presource design and overriding the Smalltalk parser

Tagged:

Paolo writes that he's looking to remove the capability to override the parser for a Behavior's methods from strings passed to #compile:, as well as old-syntax method definition lists, by moving #parserClass to CompiledMethod. He mentions that Presource fares quite well with this restriction, providing full message macros just by overriding the compiler.

Hunting down CP1252 with Iconv

Tagged:

I was looking for ways to improve a character encoding guesser in PHP, and decided that it was time to look at Iconv.

One important step to understanding how encoding or "charsets" works in GST is to understand that it is very similar to the ISO C90 model. We reinterpret the traditional String just as C strings were reinterpreted; a String is no longer quite what it appears to be.

A terrifying Presource macro: #tclCase:choose:

Tagged:

In reference to a comment about Tcl switch, enjoy a #tclCase:choose: macro for Presource. I reproduce its class comment here:

TclSwitchMacro comment:
I expand the #tclCase:choose: pseudo-message macro, which efficiently implements something approximating the Tcl `switch' command.

A #tclCase:choose: message looks like this:

 someInput tclCase: #(#regex #nocase) choose:
     {'^<?xml' -> [#xmlFile].
      '<html>' -> [#htmlFile]}.

'instance creation' method inheritance

help-smalltalk gets a question fairly frequently from users who don't know how to create Directory instances. (Incidentally, the answer is that you should use the instance creation methods inherited from File class.)

Syndicate content

User login