Merry Christmas everyone!
opal version 1.4.0 has been released!
* home: https://opalrb.com/
* github: GitHub - opal/opal: Ruby ♥︎ JavaScript
* blog post: Opal 1.4: Ruby 3.1, performance, and bundle size
opal is a Ruby to JavaScript compiler, a Ruby runtime in JavaScript and an idiomatic Ruby interface to a web browser and Node.js.
opal is tested with MSpec for the highest level of compatibility with MRI 3.1. It allows you to write complex web application frontends with not a single line of JavaScript.
This release is mostly focused on optimizing the JavaScript output size and performance and Ruby 3.1 support.
Changelog:
## [1.4.0](Comparing v1.3.2...v1.4.0 · opal/opal · GitHub) - 2021-12-24
### Added
- Implement `chomp:` option for `String#each_line` and `#lines` ([#2355](Implement `chomp` option for `String#each_line` and `#lines` by takaram · Pull Request #2355 · opal/opal · GitHub))
- Ruby 3.1 support and some older Ruby features we missed ([#2347](Ruby 3.1 support branch by hmdne · Pull Request #2347 · opal/opal · GitHub))
- Use parser in 3.1 mode to support new language-level features like hashes/kwargs value omission, the pin operator for pattern matching
- `Array#intersect?`
- `String#strip` and `String#lstrip` to also remove NUL bytes
- `Integer.try_convert`
- `public`, `private`, `protected`, `module_function` now return their arguments
- `Class#descendants`, `Class#subclasses`
- (<=1.8) `Kernel#local_variables`
- (<=2.3) Set local variables for regexp named captures (`/(?<b>a)/ =~ 'a'` => `b = 'a'`)
- Remove deprecated `NIL`, `TRUE`, `FALSE` constants
- `String#unpack` and `String#unpack1` to support an `offset:` kwarg
- `MatchData#match`, `MatchData#match_length`
- Enumerable modernization
- `Enumerable#tally` to support an optional hash accumulator
- `Enumerable#each_{cons,slice}` to return self
- `Enumerable#compact`
- `Refinement` becomes its own class now
- `Struct#keyword_init?`
- (pre-3.1) Large Enumerator rework
- Introduce `Enumerator::ArithmeticSequence`
- Introduce `Enumerator::Chain`
- Introduce `Enumerator#+` to create `Enumerator::Chain`s
- `Enumerator#{rewind,peek,peek_values,next,next_values}`
- Improve corelib support for beginless/endless ranges and `ArithmeticSequences`
- `String#[]`, `Array#[]`, `Array#[]=`, `Array#fill`, `Array#values_at`
- `Range#step` and `Numeric#step` return an `ArithmeticSequence` when `Numeric` values are in play
- Introduce `Range#%`
- `Enumerator::Yielder#to_proc`
- Fix #2367
- (2.7) `UnboundMethod#bind_call`
- (Opal) `{Kernel,BasicObject}#{inspect,p,pp,method_missing}` may work with JS native values now, also they now correctly report cycles
- `Enumerable#sum` uses Kahan's summation algorithm to reduce error with floating point values
- `File.dirname` supports a new `level` argument
- Vendor in `optparse` and `shellwords` ([#2326](Opal-in-Opal workshop by hmdne · Pull Request #2326 · opal/opal · GitHub))
- Preliminary support for compiling the whole `bin/opal` with Opal ([#2326](Opal-in-Opal workshop by hmdne · Pull Request #2326 · opal/opal · GitHub))
### Fixed
- Fix coertion for `Array#drop` ([#2371](Move aliases to the end of classes by elia · Pull Request #2371 · opal/opal · GitHub))
- Fix coertion for `File.absolute_path` ([#2372](Fix io puts by elia · Pull Request #2372 · opal/opal · GitHub))
- Fix some `IO#puts` edge cases (no args, empty array, nested array, …) ([#2372](Fix io puts by elia · Pull Request #2372 · opal/opal · GitHub))
- Preserve UNC path prefix on File.join ([#2366](resolves #2348 preserve UNC path prefix on File#join (Node.js impl) by Mogztter · Pull Request #2366 · opal/opal · GitHub))
- Methods on `Kernel`, `BasicObject`, `Boolean` will never return boxed values anymore ([#2293](Stop returning boxed values for boolean, number, string objects when returned by any of BasicObject Boolean & Kernel by hmdne · Pull Request #2293 · opal/opal · GitHub))
- `false.tap{}` will now correctly return a JS value of `false`, not `Object(false)`
- opal-parser doesn't break on `<<~END` strings anymore ([#2364](Fix opalopal <<~END support. by hmdne · Pull Request #2364 · opal/opal · GitHub))
- Fix error reporting at the early stage of loading ([#2326](Opal-in-Opal workshop by hmdne · Pull Request #2326 · opal/opal · GitHub))
### Changed
- Various outputted code size optimizations - 19% improvement for minified unmangled AsciiDoctor bundle - see: Optimizing Opal output for size ([#2356](Generated code optimization by hmdne · Pull Request #2356 · opal/opal · GitHub))
- Second round of code size optimizations - 3% improvement for AsciiDoctor bundle on top of the first round - 23% total - see: Second batch of generated code optimization by hmdne · Pull Request #2365 · opal/opal · GitHub ([#2365](Second batch of generated code optimization by hmdne · Pull Request #2365 · opal/opal · GitHub))
- The calls to `==`, `!=` and `===` changed their semantics slightly: it's impossible to monkey patch those calls for `String` and `Number`, but on other classes they can now return `nil` and it will be handled correctly
- The calls to `!` changed their semantics slightly: it's impossible to monkey patch this call for `Boolean` or `NilClass`.
- Refactored the structure of the internal `stdlib/nodejs` folder ([#2374](Docs & opal/platform fixes by elia · Pull Request #2374 · opal/opal · GitHub))
- Added `nodejs/base` with just I/O, exit, and ARGV management
- Moved `Process::Status` to corelib
- Fixed requires to be more robust
### Removed
- Removed `nodejs/irb` from stdlib as it's been broken for some time ([#2374](Docs & opal/platform fixes by elia · Pull Request #2374 · opal/opal · GitHub))
- Removed `Kernel#node_require` from `nodejs/kernel` as it's been deprecated for a long time ([#2374](Docs & opal/platform fixes by elia · Pull Request #2374 · opal/opal · GitHub))