Skip to content

0.8.0

Choose a tag to compare

@Sainan Sainan released this 20 Dec 23:45
· 1473 commits to main since this release
  • Added switch expressions
  • Added shorthand fallthrough syntax for switch statement & expression, e.g. case 1, 2: ...
  • Added try...catch statement
  • Added spaceship operator (<=>)
  • Added safe navigation for method calls: nilable_inst?:method(), inst:nilable_method?(), nilable_inst?:nilable_method?()
  • Added optional 'const' keyword as shorthand for local ... <const> [= ...], enabled with pluto_use const.
  • Added pluto_use "VERSION+"
  • Tables now have a metatable by default ({ __index = _G.table }).
  • Added '!' as an alias for 'not'
  • Added 'private' modifier for class fields
  • Improved 'class' and 'extends' to support indexed names
  • Improved 'instanceof' to be usable with more complex expressions
  • export now works in all scopes, not just the main body
  • Updated in operator on tables to check values instead of keys
  • \{ is now a valid escape sequence (for interpolated strings)
  • Fixed to-be-closed variables not working in switch cases
  • Fixed 'new' not working as expected if it was disabled by the environment and re-enabled by 'pluto_use'
  • Fixed 'enum class' not incrementing enumerator values
  • Fixed not being able to use expressions such as increment in enum without parentheses
  • Added compile-time concat optimization

Warnings:

  • Added warning for local attributes used without '<' ... '>'
  • Now propagating types for global variables so when their value is assigned to something, mismatches can be detected.
  • Added optional global-shadow warning which is like var-shadow but for globals that are especially vulnerable to obscure shadowing bugs (to prevent excessive annoyance).
    • These globals include: arg,string, and table. Integrators can change this via PLUTO_COMMON_GLOBAL_NAMES
    • Global shadow warnings do not apply to localization optimization (i.e, local table = table)
  • var-shadow has been improved to check more enclosing scopes
  • Improved unreachable-code
  • Fixed var-shadow warning for locals used in switch cases despite break
  • Added optional non-portable-code, non-portable-bytecode, and non-portable-name warning types
  • Warnings can now be promoted to errors, e.g. @pluto_warnings error-all

Standard library:

  • Soup is now always linked in, obsoleting _PSOUP
  • Added assertion library (see here for more preliminary detail)
  • Added url library (encode & decode)
  • Added exception class
  • Added vector3 class
  • Added dumpvar & exportvar
  • Added string.truncate
  • Added string.replace — a slightly faster, but mostly more straightforward alternative to gsub.
    • Most notably, not burdened by MAX_CAPTURES
  • Added string.formatint (supports any BigInt impl that can offer the user a string representation)
    • Also supports any grouping & any separator without concerning locale.
  • Added table.filter
  • Added table.map
  • Added table.reverse
  • Added table.reorder
  • Added io.currentdir
  • Added io.part
  • Added io.writetime
  • Added math.isnan
  • Added compareversions
  • Added wcall
  • Added math.atan2 as an alias for math.atan
  • Added json.null
  • io.absolute now has an optional argument to request a canonicalized absolute path
  • Updated string.rfind to accept Lua patterns
  • Renamed io.copyto to io.copy
  • Renamed base64.url_encode & base64.url_decode to base64.urlencode & base64.urldecode
  • Deprecated string.find_first_of & string.find_first_not_of in favor of string.find
  • Deprecated string.find_last_of & string.find_last_not_of in favor of string.rfind
  • Deprecated string.lfind in favor of string.find
  • Deprecated crypto.hexdigest in favor of string.format
  • Modified require
    • Prioritizes local files now to ensure compatibility. Added require("pluto:libname") to explicitly request pluto libraries if ever needed (normal still works for pluto libraries, we just check for local files first).
  • Removed base58

For integrators:

  • Added PLUTO_NO_FILESYSTEM - disables all filesystem access (for sandboxing).
  • Added PLUTO_WARN_NON_PORTABLE_CODE
  • Added PLUTO_WARN_NON_PORTABLE_BYTECODE
  • Added PLUTO_WARN_NON_PORTABLE_NAME
  • Added PLUTO_NO_BINARIES - disables all dll/so/c module loading (for sandboxing)
  • Added luaG_addsrcinfo

Far more information can be found at our documentation: https://pluto-lang.org/