What's New in Snap! 9?

This is not technically a project I'm sharing, but people usually ask what's new in Snap! when an update comes out (yes, Snap! 9 released a few moments ago).


  • New Features:
    • new "this" reporter for introspection offering access to "script", "caller", "continuation" and "inputs", enabling programs to access their dynamic scope and runtime call-stack
    • "call" is now hyperized and accepts a list/table etc. of rings as procedure input, returns a list/table etc. of applying all arguments to each ring. Currently constrained to primitive data (text, number, Boolean) inputs, albeit in any dimension (e.g. lists of lists of data)
    • new "extent" selector in the "(attribute) OF (object)" reporter's dropdown menu returns a list if width-height coordinates
    • new "uniques" selector in list properties reporter's dropdown, answers a new list containing the source list's unique values based on equality (i.e. a set)
    • new "sorted" and "shuffled" selectors in list properties reporter's dropdown
    • new "stage", "agent" and "script" selectors in "is a?" reporter's dropdown
    • new "case sensitivity" preference setting
    • new "case sensitivity" selector to the setting blocks' dropdowns
    • new dropdown menu with "length", "lower case" and "upper case" selectors in the "length of text" reporter
    • new option to make individual input slots in custom blocks "static", i.e. irreplaceable by reporters
    • new option to specify a "separator" (infix) label for variadic input slots inside custom blocks
    • new "replaceables" selector in block-attributes dropdown, manages whether inputs slots are static
    • new "separators" selector in block-attributes dropdown, manages infix-separators for variadic input slots
    • new "comment" selector in block-attributes dropdown, accesses cutom block definitions' help text, i.e. comments attached to the prototype hat
    • new context comments preserve ring comments and hat block comments in the evaluator for later introspection
    • new "generate puzzle" feature - single click Parson's Puzzle generator for educators
    • new "solutions" selector in the "my (attributes)" reporter, answers a dictionary of a puzzle sprite's solution scripts tagged by their comments, if any
    • new "Tiles" library, divides the stage into sub-regions in each of which to perform an action
    • new "Arcs" library, turns sprites by a delta of degrees moving them at a given radius
    • new "Sarron" and "Aleassa" costume series, thanks, Meghan and Brian!
    • new Armenian translation, yay! Thanks to the contributors!
    • new embedding configuration options: noSpriteEdits
    • Expanded the #open: URL scheme to accept image URLs.
    • new "ide_translation_dict", "ide_set_translation_dict(data)" and "txt_export(txt, name)" extension primitives
    • new "hideDefaultCat" configuration setting, lets you hide the default built-in category buttons
  • Notable Changes:
    • IF is now variadic and expandable with "else if" cases
    • explicit variadic input list visuals
    • "this script" reporter has been morphed into the new general "this" introspection/self reflection reporter
    • RUN/CC and CALL/CC primitives have been deprecated and removed from the palette, will still be present and work in existing projects
    • changed the first input slot of the "reshape" block from "list" type to "any" type
    • changed JOIN, APPEND and COMBINATIONS to show "with" infix label in between inputs, and to collapse from 2 inputs directly to "input list" case, same as +, min, AND etc. (monadic uses in existing projects will not change)
    • dragging blocks and scripts out of balloons and watchers now only includes the surrounding ring if it has formal parameters
    • changed the semantics of empty list-type slots to return a new empty list instead of "nothing"
    • improved browser resource management for graphics and sounds
    • changed long-form input dialog setting's behavior to automatically expand / collapse slot type view
    • made "distribution" list selector case-sensitivity setting aware and optimized for atomic data
    • slightly optimized pen drawing performance when WARPed
    • removed multibranched conditional library (cases.xml), because IF is now variadic
    • removed the "remove duplicates" reporter from the "list utilities" libraries because it is now a primitive
    • updated audio comp library with a faster (hyper) version of the "Hz for secs" reporter
    • updated animation library with a faster (hyper) version of "glide" and added "steps" selector to the "animate" command
    • new "fade-in" block in the audio comp library lets you reduce audible "clicks" in sounds computed from raw samples
    • messages and identifying sprites, costumes and sounds by their names is now case-insensitive by default (e.g. in "object", "broadcast", "of" blocks)
    • translations now use abstract block specs
    • updated the strings library for and with the new case sensitivity and lower case primitives
    • generated JSON strings are now (somewhat) pretty printed (with newlines and indentations)
    • increased arrows heads size for variadic inputs and dropdown menus
    • confined the red drop-target halo of multi-slots to the boundaries of its arrows / arity controls
  • Notable Fixes:
    • fixed #3154 (let "this script" capture variables in rings)
    • catch misspelled or non-existing translation keys in urls and elsewhere, thanks, Joan!
    • fixed a bug that led to the default input of "When I am clicked" not being translated
    • fixed serializing complex inputs to contexts (procedure objects)
    • fixed dragging blocks, costumes and sounds out of table views
    • fixed #3207 (initial arrow head orientation for long form input slot dialog)
    • fixed a number/text type glitch in the "(ray length) TO (sprite)" reporter for hyperized angular offsets
    • fixed #3180 (preserve zero values in blockified lists instead of turning them into empty slots)
    • fixed stopping ASK prompter under certain race conditions
    • fixed MAP, KEEP, FIND and COMBINE primitives to work with JS-funargs
    • fixed assigning same costume names to recurrent video snaps
    • fixed sound naming rules for same-named imports
    • fixed preserving embedded scripts when collapsing variadic c-slots
    • fixed preserving embedded scripts when relabelling blocks with variadic c-slots
    • improved sensing precision when clicking on variadic slot arrows
    • fixed JIT-compiling variadic Boolean infix ops (AND, OR)
    • fixed identity case for COMBINATIONS
    • fixed occasional costume reference error for computed, non-wardrobe costumes in sprite-duplicates
    • fixed the "stage size" reporter in the "Getters and setters" library
    • fixed accessing negative indices in linked lists
  • Documentation Updates:
    • extended API documentation for "noSpriteEdits" and "hideDefaultCat" configurations
    • updated CONTRIBUTING.MD for the new underscore-placeholder notation for block input slot translations
  • Translation Updates:
    • German
    • Greek, thanks, HM100!
    • Armenian, thanks to the contributors!

very nice!

Yay! What motivates replacing CALL/CC with THIS CONTINUATION?

"Agent" is clearer than "object" for a sprite/the stage (although with the OBJECT block it's fine).

um, I don't see that

untitled script pic (19)

Now, it is worth mentioning that I did notice it in the dev version a while ago.

i like this version better anyways. less clutter

Same. Personally I think putting the word "with" between 2 inputs is fine, it's just putting it between more than 2 makes it look weird.

Not to mention needlessly wide. Jens was so excited with infix operators that he overdid it. ;~)

Simple programs
An interesting addition to the File menu! It's quite easy to use for simple programs, i.e. without custom blocks, recursion, and all that sort of complications.

From this simple program:

Parsons square solution script pic (1)

... the following Parson's puzzle is generated:

Parsons square solution script pic

All the student must do is arrange the blocks in the right order, and adjust parameters. Not a problem!

More advanced puzzles
I'm not saying it can not be done ... but since the problem generator only works on code in a sprite's script area (so not on the definition of custom blocks), testing a student's ability in more advanced programming is going to be, well, a bit complicated itself. As an example I had Snap! generate a Parson's puzzle from a recursive implementation of the factorial function. Because a custom block couldn't be used, I assigned an anonymous function to a variable:

Parsons factorial solution script pic (1)

And these are the generated puzzle's elements:

Parsons factorial puzzle script pic

In this case the programming task is substantially complicated by fringe elements, I think. So perhaps something to further develop in a next version of Snap!. :smiley:

I think the idea is that in the contexts that teachers have actually wanted, custom blocks are meant to be teacher-written, context-specific pseudo-primitives. So it would be counterproductive to look inside them in making a puzzle. And if the kid writes one, they haven't done so yet as we're setting up the puzzle! Yes, you can, I'm sure, come up with a more plausible use case. When teachers ask us to support that, we'll consider it.

dang that was my favorite one. however, because of the variadic if blocks, I cant seem to make an else case (not else if). if you guys could add a dedicated else case to the end of it (maybe just add it to the already existing if/else) that would be nice.

if else is the same as if else if true


untitled script pic - 2023-09-29T113930.945

yes but I'm asking for a dedicated way