Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.8.0 #328

Merged
merged 455 commits into from
Dec 20, 2023
Merged

0.8.0 #328

merged 455 commits into from
Dec 20, 2023

Conversation

Sainan
Copy link
Member

@Sainan Sainan commented Jul 20, 2023

  • 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) (may be backported to 0.7.x?)
  • Fixed to-be-closed variables not working in switch cases

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 global-shadow warnings 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 extend this via PLUTO_EXTENDED_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

@well-in-that-case well-in-that-case marked this pull request as ready for review December 20, 2023 23:40
@well-in-that-case well-in-that-case merged commit 6c247b1 into main Dec 20, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants