You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add strscan implementation for TruffleRuby in this repository #194
I would like to have the implementation of strscan for TruffleRuby (pure Ruby, using some TruffleRuby primitives) in this repository. @kou From previous discussions my understanding is you would like this too, right?
The advantages are:
It can evolve with other implementations (C extension, JRuby extension)
Updating the strscan gem also updates the strscan implementation on TruffleRuby vs always using the hardcoded version in TruffleRuby stdlib. Which is great for e.g. getting new strscan methods. And BTW strscan seems one of the most active default gems so this is important.
Tests no longer need to be skipped on TruffleRuby, as new methods would be implement for TruffleRuby too at the same time (happy to help there if it's not obvious, or to help review those changes).
It should be easy to maintain as it's pure Ruby, I'd even say significantly easier than the C extension & JRuby extension.
There is one concern though, https://github.com/truffleruby/truffleruby/blob/9d04568aea74521efd087995c795707dbcb302af/lib/truffle/strscan.rb has a non-trivial license, basically BSD-3-Clause + EPL/LGPL/GPL (could pick EPL which is the most permissive of the 3).
In my understanding, EPL is less permissive than BSD/MIT and if that file was copied in the gem it would mean licensing the gem as ["Ruby", "BSD-2-Clause", "EPL"] instead of the current ["Ruby", "BSD-2-Clause"].
That seems not great for a default gem like strscan, so I suppose that licensing the gem like that would be a problem. @kou Could you confirm that wouldn't be fine?
Relicensing that implementation to just BSD 3-Clause is unfortunately not feasible.
(FWIW this is the only stdlib with that complicated license, other stdlibs like stringio.rb are fine and just BSD-3-Clause)
Therefore I'm thinking to reimplement strscan from scratch for TruffleRuby directly in this repository, using BSD-2-Clause to match an existing license of the gem.
It's ~400 lines of Ruby code so should not be too much work.
I could also start from the last version before the EPL/LGPL/GPL license was added, doesn't change much, would just be BSD-3-Clause then.
BTW this is the version imported from rubysl-strscan.
Before going ahead though, @kou would you in principle support adding that new implementation of strscan for TruffleRuby in the strscan repository?
You might need to get past contributors to agree to a license change, starting with @brixen. It's an annoying process but it would guarantee a clean license.
You might need to get past contributors to agree to a license change, starting with @brixen. It's an annoying process but it would guarantee a clean license.
I thought about that and looked into it quite a bit but it's not feasible in this case (I'll spare the details here).
So a fresh new implementation, or one based on the rubysl implementation (which is BSD-3-Clause so that'd be fine to keep) would avoid the need to relicense-by-asking-everyone the existing implementation.
I'm fine to do that work, the issue is more about whether the EPL license would be fine or not, and whether the new implementation would be welcomed in this repository.
From previous discussions my understanding is you would like this too, right?
Right.
Could you confirm that wouldn't be fine?
We can't use ["Ruby", "BSD-2-Clause", "EPL"] nor ["Ruby", "BSD-2-Clause"] with BSD-3-Clause code because BSD-3-Clause has one more condition than BSD-2-Clause.
Let's try asking the copyright holders to re-license to the "Ruby or BSD-2-Clause" license before we re-implement the current implementation.
would you in principle support adding that new implementation of strscan for TruffleRuby in the strscan repository?
Activity
headius commentedon Mar 7, 2026
You might need to get past contributors to agree to a license change, starting with @brixen. It's an annoying process but it would guarantee a clean license.
eregon commentedon Mar 7, 2026
I thought about that and looked into it quite a bit but it's not feasible in this case (I'll spare the details here).
So a fresh new implementation, or one based on the rubysl implementation (which is BSD-3-Clause so that'd be fine to keep) would avoid the need to relicense-by-asking-everyone the existing implementation.
I'm fine to do that work, the issue is more about whether the EPL license would be fine or not, and whether the new implementation would be welcomed in this repository.
kou commentedon Mar 7, 2026
Right.
We can't use
["Ruby", "BSD-2-Clause", "EPL"]nor["Ruby", "BSD-2-Clause"]with BSD-3-Clause code because BSD-3-Clause has one more condition than BSD-2-Clause.Let's try asking the copyright holders to re-license to the "Ruby or BSD-2-Clause" license before we re-implement the current implementation.
Yes.
Implement StringScanner for TruffleRuby in pure Ruby
eregon commentedon Mar 9, 2026
I implemented it from scratch using BSD-2-Clause, see #195
Implement StringScanner for TruffleRuby in pure Ruby
Implement StringScanner for TruffleRuby in pure Ruby
Implement StringScanner for TruffleRuby in pure Ruby
Implement StringScanner for TruffleRuby in pure Ruby
Implement StringScanner for TruffleRuby in pure Ruby
Implement StringScanner for TruffleRuby in pure Ruby (#195)
[ruby/strscan] Implement StringScanner for TruffleRuby in pure Ruby