Comment by jandrese

9 hours ago

It's kind of a shame this uses its own, probably more powerful, language instead of HyperTalk.

HyperTalk is one of the most accessible languages for beginners I've ever seen. Sure it was primitive and had somewhat weak data organization capabilities, but if you're like 6 it's pretty incredible for your experience to be:

    1. Open a blank script
    2. Drag a field on the screen and name it "myname"
    3. Drag a button on the screen, open up it's script and see:
       on mouseUp
       end mouseUp
    4. You then enter the following two lines between those two lines:
         ask "What is your name?"
         put it into card field myname
    5. Then you go back and click the button and a dialog box appears asking your name and when you type it in an hit enter the name appears in the field you created.

That sort of directness is lost in modern development environments. The concept that the button's script lives inside of the button, and in fact everything on the page could have its own script. The page itself also has script, even the stack itself. Your code can of course call code in other objects if need be (typically at the page or stack level), and there is a whole message passing thing happening in the background. It's by far the most intuitive programming environment I've ever seen. It has the kind of immediate impact that helps to save off boredom or feeling like there's too much homework before the fun starts.

In the day people complained about the syntactic sugar in HyperTalk, but I think it was just right for the target audience. They did have more of a point about the difficulty in managing structured data, often having to store things in hidden fields referenced by line and word number or hacks like that.

The most incredible part is this was all in an application that came with the OS. It was the perfect opportunity for a bored kid to randomly come across it and discover a lifelong passion. There was nothing to install, no product to buy first--it was just there, asking to be discovered. And even if your parents weren't about to buy a reference book you could open up other stacks and start reading the code to learn the language. Because most scripts were small and self contained (remember that they were stored at the widget level) this was a legitimate way to understand the basic syntax and keywords.

In Decker, most of this example would be similar. The button's default script template would be:

    on click do
    
    end

And filling it in with an equivalent script would be something like:

    on click do
     myname.text:alert["What is your name?" "string"]
    end

There is slightly more "programming-language-like" punctuation to Lil than HyperTalk, but simple examples are still simple, and in my opinion having first-class collections (lists, dictionaries, tables) and a richer set of APL-like operators makes Lil scale up much better to more complex programs. As a child I recall struggling tremendously with HyperTalk's "almost-english" structure; it made scripts easy enough to read and understand, but provided very little help when it came to writing new scripts.

Decker has a similar Widget -> Card -> Deck event bubbling hierarchy to HyperCard, and in my opinion retains much of the same directness and simplicity for simple applications. The differences in approach won't please everyone, but they are all carefully considered, and have been refined over time based on feedback from the user community. Decker is a living, growing platform!

  • Your example needs to add the part where you put that string into a card field so people can see their work.

    But your example also includes a period, a colon, square brackets, and a space where someone might expect a comma. It's going to look a lot more daunting to a first time programmer. Simply knowing when to use a period vs. the colon is not going to be obvious.

    • The alert[] function prompts the user for input. The second "string" argument indicates the prompt will ask for a string, and return it. (alert[] can also ask for other datatypes, like a yes/no "boolean" prompt or a multi-choice selection from a list or dictionary of options.)

      The colon (read aloud as "becomes" or "gets") is Lil's assignment operator. That single line,

          myname.text:alert["What is your name?" "string"]
      

      prompts for input and then stores the result in a card field. If you wish, you could also write it as:

          on click do
           name:alert["What is your name?" "string"]
           myname.text:name
          end
      
      

      Learning the syntax for calling functions is partially scaffolded by the "Action..." dialog that button widgets offer for constructing simple button scripts with a GUI:

          on click do
           go["Next" "BoxIn"]
           play["sosumi"]
          end
      

      Users can rely on the system to write code for them initially, and then slowly dip their toes into more complex compositions. Whereas HyperTalk has custom syntax for almost every programming construct and built-in function or feature, the Lil grammar is simple and uniform. Where symbols appear, they have a single meaning. Decker's "Listener" REPL allows the user to have a back-and-forth "conversation" with the Lil interpreter and see responses juxtaposed with their questions, versus the HyperCard "message box" which shows only user input or a single system response.

      Ultimately, every programming language does require some degree of handholding and learning, and that's why Decker comes with dozens of example decks to take apart and study. The user community has also furnished some truly fantastic interactive tutorials:

      https://ahmwma.itch.io/phield-notes