‹ BackHN Continuity

Thread

RacketCon Is Saturday

158 points · 49 comments · spdegabrielle

  1. dharmatech · · focus · HN ↗
    I've been messing around with a language that I summarize as:

    ALOE = Scheme + Smalltalk + Types

    <a href="https:&#x2F;&#x2F;github.com&#x2F;dharmatech&#x2F;2026-09-02-aloe-racket" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dharmatech&#x2F;2026-09-02-aloe-racket

    Prototype is in Racket.

    1. attila-lendvai · · focus · HN ↗
      you lost me at the receiver selector order.
      1. Jtsummers · · focus · HN ↗
        It&#x27;s a common way to implement OO in Lisp-y languages, and it fits if you&#x27;re taking Smalltalk as an inspiration. SICP has an example in chapter 3 (IIRC) of doing the same, but the selector had to be quoted as in:

          (my-account &#x27;balance)
          (my-account &#x27;withdraw 10)
        1. so-cal-schemer · · focus · HN ↗
          Uses an internal lambda for dispatching on messages.

          We can also create objects that handle deposits as well as withdrawals, and thus we can represent simple bank accounts. Here is a procedure that returns a “bank-account object” with a specified initial balance:

            (define (make-account balance)
              (define (withdraw amount)
                (if (&gt;= balance amount)
                    (begin (set! balance 
                                 (- balance amount))
                           balance)
                    &quot;Insufficient funds&quot;))
              (define (deposit amount)
                (set! balance (+ balance amount))
                balance)
              (define (dispatch m)
                (cond ((eq? m &#x27;withdraw) withdraw)
                      ((eq? m &#x27;deposit) deposit)
                      (else (error &quot;Unknown request: 
                             MAKE-ACCOUNT&quot; m))))
              dispatch)
          
          Each call to make-account sets up an environment with a local state variable balance. Within this environment, make-account defines procedures deposit and withdraw that access balance and an additional procedure dispatch that takes a “message” as input and returns one of the two local procedures. The dispatch procedure itself is returned as the value that represents the bank-account object. This is precisely the message-passing style of programming that we saw in 2.4.3, although here we are using it in conjunction with the ability to modify local variables.

          3.1.1 Local State Variables

          <a href="https:&#x2F;&#x2F;sarabander.github.io&#x2F;sicp&#x2F;html&#x2F;3_002e1.xhtml#g_t3_002e1_002e1" rel="nofollow">https:&#x2F;&#x2F;sarabander.github.io&#x2F;sicp&#x2F;html&#x2F;3_002e1.xhtml#g_t3_00...

          1. Jtsummers · · focus · HN ↗
            A closure, specifically, because closures are a poor man&#x27;s object.

            <a href="https:&#x2F;&#x2F;wiki.c2.com&#x2F;?ClosuresAndObjectsAreEquivalent" rel="nofollow">https:&#x2F;&#x2F;wiki.c2.com&#x2F;?ClosuresAndObjectsAreEquivalent

            1. apgwoz · · focus · HN ↗
              You fool! Objects are a poor man’s closures!
              1. [deleted] · · focus · HN ↗

                [deleted]

        2. dharmatech · · focus · HN ↗
          Yup!

          Here&#x27;s a video demo of the code completion in vscode:

          <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YuIjug7elPY" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=YuIjug7elPY

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.