Skip to content

SPWN (0.8 beta)

Pre-release
Pre-release
Compare
Choose a tag to compare
@Spu7Nix Spu7Nix released this 25 Jan 20:01
· 98 commits to master since this release

0.8: The "a bit of everything" update

Breaking Changes

  • Keyword switch is now match
  • Keyword case is removed (in favor of == patterns)
  • Unary .. operator is no longer allowed (for example ..10 now needs to be written as 0..10)
  • The has operator has been replaced with in (with the order flipped)

New Features

  • Return types for macros with (arguments) -> return_type { ... } syntax
  • You can spread an array in another array with .. syntax:
  • spwn eval subcommand for running code in the console
b = [3, 4]
$.assert([1, 2, ..b, 5] == [1, 2, 3, 4, 5])
  • Unzip arrays with *[...] syntax:
a = [1, "a"]
b = [2, "b"]
c = [3, "c"]
$.assert([*[a, b, c]] == [[1, 2, 3], ["a", "b", "c"]])
  • Destructuring additions, including dictionary destruction, and destruction of the syntax mentioned above (.. and *[...])
  • Big expansion to the pattern system:
    • is operator for matching any value to a pattern (10 is @number // true)
    • using most boolean operators as unary operators now yield a pattern:
      • ==val will match any value that equals val
      • !=val will match any value that does not equal val
      • >val will match any value that is greater than val
      • <val will match any value that is less than val
      • >=val will match any value that is greater than or equal to val
      • <=val will match any value that is less than or equal to val
      • in val will match any value that is in val
    • & operator for combining two patterns, so that the resulting pattern requires the value to match both patterns
    • _ pattern, which matches any value (wildcard)
    • pattern ternary operator, which returns a value if it matches a pattern, and otherwise returns the default value:
      10 if is >5 else 0 // 10
      4 if is >5 else 0 // 0
  • You can now remove stuff from dictionaries with dict.delete(key)

STD Library Features

  • @chroma type for color values, this type is now used in for example color triggers instead of RGB arguments
  • level global variable for reading the objects in the current level
  • @log and @runtime_log types for debug logging to the console or at runtime
  • @set type for making groups of objects read from the level that can be rotated, scaled, and pasted in the level
  • Changes and improvements to many existing types (see the docs)

New Contributors

  • @DexterHill0 made their first contribution in #146
  • @Fl1pNatic made their first contribution in #154

Full Changelog: v0.7-beta...v0.8-beta

To install, download and run the appropriate installer (from the "Assets" dropdown below):

spwn-0.0.7-x86_64_win2.msi for windows 64 bit
spwn-0.0.7-x86_32_win2.msi for windows 32 bit
spwn-0.0.8-x86_64-linux_arch.pkg.tar.zst for arch linux
spwn-0.0.8-x86_64.tar.gz for linux (tarball)
spwn-0.8_beta.pkg for MacOS
(Installers for more platforms coming soon)