← Back to context

Comment by RodgerTheGreat

9 hours ago

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