[HN Gopher] Slang: The subset of Smalltalk that can translate to...
       ___________________________________________________________________
        
       Slang: The subset of Smalltalk that can translate to C or other
       languages (2019)
        
       Author : avowud
       Score  : 49 points
       Date   : 2022-07-28 11:28 UTC (1 days ago)
        
 (HTM) web link (wiki.squeak.org)
 (TXT) w3m dump (wiki.squeak.org)
        
       | cxr wrote:
       | Who has an account on this wiki and how did you get it? The wiki
       | pages have an Edit button, but it uses an HTTP auth prompt, and
       | cancelling it doesn't provide any details about how to register.
       | I also don't see anything after looking around elsewhere on the
       | wiki itself, nor does Googling turn anything up.
        
         | kencausey wrote:
         | It is an open secret within the Squeak community. Participate
         | in the community for a while and I'm sure someone will be happy
         | to give it to you.
        
           | cxr wrote:
           | > Participate in the community for a while
           | 
           | Well, you see, that's what I'm trying to do here...
        
             | kencausey wrote:
             | Well, this isn't the right place to do it. At least
             | introduce yourself on the squeak-dev or beginners email
             | lists and ask for the ability to edit the swiki there. It
             | would also help to mention your immediate plans.
             | 
             | The swiki is extremely old-school and simplistic and has
             | suffered defacement issues in the past. Also,
             | unfortunately, the overall Smalltalk community (at least
             | the open source part) is both too small and at this time
             | terribly fractured. Resources like the swiki have had
             | little real attention for many many years.
        
       | sebastianconcpt wrote:
       | Slang is challenging!
       | 
       | I was implementing a plugin for Pharo the other day and it really
       | feels like metaprogramming in C.
       | 
       | I have pending in my to-do list making a blog post with a
       | friendly how-to for making a HelloWorldPlugin so more people can
       | play with it.
        
         | jecel wrote:
         | The main goal for Slang was to be able to use the Smalltalk
         | debugger instead of something like gdb. Since you are
         | essentially writing C but with a Smalltalk syntax the code
         | itself is not any simpler, so it is all about the tools.
        
       | Qem wrote:
       | A nice thing about Smalltalk and derived languages, like Pharo,
       | is that they manage being written in themselves nearly down to
       | metal, and that improves learnability a lot, as one can dive deep
       | only knowing the language itself. I code mostly in Python, but
       | sometimes is hard to take a deep dive there without smashing
       | one's head against the C bedrock underneath, at least for
       | somebody like me, that doesn't really know C.
        
         | qsort wrote:
         | I can see why this is frustrating, especially to someone with
         | no C exposure. But bear in mind that the C underpinnings are
         | part of the reason why these languages are popular in the first
         | place -- like Perl used to be before Python.
         | 
         | In a very real sense, the entire concept of an interpreted
         | language in the modern sense is such an ugly kludge (much
         | cleaner to "go all in" on the language, LISP machines being the
         | notable predecessor) -- but do be aware of the tradeoff.
        
           | moron4hire wrote:
           | I cannot make heads or tails of what this person is trying to
           | say
        
             | jrvarela56 wrote:
             | You can ask them a question instead of insinuating that
             | what they said did not make sense.
        
             | sebastianconcpt wrote:
             | I read your username just after finishing reading this
             | comment of yours.
             | 
             | I'm taking your question as genuine, but you provided some
             | fun value with that hehehehehe
        
             | marktangotango wrote:
             | There's a fair amount to unpack here.
             | 
             | > I can see why this is frustrating, especially to someone
             | with no C exposure. But bear in mind that the C
             | underpinnings are part of the reason why these languages
             | are popular in the first place -- like Perl used to be
             | before Python.
             | 
             | I the idea GP is proposing here is that because C is so
             | cumbersome, that is why scripting languages became
             | prominent in the first place. I don't think this many would
             | argue with this.
             | 
             | > In a very real sense, the entire concept of an
             | interpreted language in the modern sense is such an ugly
             | kludge
             | 
             | Here GP is implying that if C were nicer/better, or if some
             | other low level language would have risen to prominence,
             | the scripting langauges would not have been "necessary" or
             | desirable in the same way.
             | 
             | > (much cleaner to "go all in" on the language, LISP
             | machines being the notable predecessor) -- but do be aware
             | of the tradeoff.
             | 
             | Here I assume GP is referring to the work in the 80s on
             | Lisp machines where the idea was to build machines from the
             | ground up more suited to a different paradigm. And thus
             | obviating the need for a cumbersome language such as C.
             | 
             | I personally wonder if GP is familiar the "worse is better"
             | essay?
        
               | qsort wrote:
               | Wow, I should work on my prose, that comment I wrote was
               | really bad :-(
               | 
               | > I personally wonder if GP is familiar the "worse is
               | better" essay?
               | 
               | I am, it was more or less the idea I was trying to get
               | to. The comment I replied to was along the lines of "I'd
               | like a uniform environment where everything is
               | lisp/smalltalk/pharo/etc". My intention was to point out
               | how that idea isn't as free from compromises as it might
               | seem, which explains the dominant model of high-level
               | scripting languages invoking components written mostly in
               | C/C++. Which is a total eyesore, but also extremely
               | practical.
        
             | chakkepolja wrote:
             | My guess: C underpinning -> easy c bindings my guess. At
             | least th, can easily write bottleneck parts in C. (why
             | python is popular.)
        
         | sebastianconcpt wrote:
         | Our brains adore consistency.
         | 
         | Smalltalk embraced that from the surface of its skin to the
         | deeps of its soul:
         | 
         | From Dan Ingalls Design Principles Behind Smalltalk
         | https://www.cs.virginia.edu/~evans/cs655/readings/smalltalk....
         | 
         | "Uniform Metaphor: A language should be designed around a
         | powerful metaphor that can be uniformly applied in all areas."
         | 
         | "Personal Mastery: If a system is to serve the creative spirit,
         | it must be entirely comprehensible to a single individual."
         | 
         | "Messages: Computing should be viewed as an intrinsic
         | capability of objects that can be uniformly invoked by sending
         | messages."
        
       | tengwar2 wrote:
       | I'm very much a beginner with Smalltalk but have used C since
       | K&R. I'm having difficulty with the statement that Slang is a
       | dialect of Smalltalk which "does not have blocks (except for a
       | few control structures), message sending or even objects." How
       | can you have even a subset of Smalltalk without these? Even
       | something as basic as an "if" statement uses all three. I see the
       | examples, but they don't shed much light. Or is the grammar
       | wrong, so the sentence is intended to say that the C output does
       | not have objects etc.?
        
         | Jtsummers wrote:
         | I'm not sure about objects, but at least for control structures
         | like "if" the answer is in your quote:
         | 
         | > (except for a few control structures)
         | 
         | Blocks are available specifically for those limited control
         | structures, like "if".
        
         | erik_seaberg wrote:
         | I think they're saying ifTrue: is an intrinsic in their
         | transpiler, so the method call is skipped and replaced with a C
         | statement. They could have chosen instead to generate C code
         | that actually invokes a method on a receiver (using whatever
         | their calling convention is for methods), which would be slower
         | but monkey-patching would work as usual.
        
       ___________________________________________________________________
       (page generated 2022-07-29 23:01 UTC)