659 karma · joined January 12, 2012
https://hyperbo.la | https://www.artichokeruby.org
For example, one may wish to use Artichoke in a game engine for scene scripting. It’s probably undesirable for Ruby code run in this context to modify the host environment, so `ENV` can be disabled at compile time. But maybe you have existing code that uses `ENV`. Toggle a compile time flag and you can get a compatible `ENV` implementation that is backed by a hash map.
[0]: https://github.com/artichoke/artichoke/tree/97ba69d31154be45...
[1]: https://github.com/artichoke/artichoke/tree/97ba69d31154be45...
[2]: https://rocket.rs/
[0]: https://github.com/artichoke/www.artichokeruby.org/pull/171
- https://twitter.com/artichokeruby/status/1339581223119679493
- https://twitter.com/artichokeruby/status/1339578582222266368
- https://twitter.com/artichokeruby/status/1332772105126105089
- https://twitter.com/artichokeruby/status/1332880679655247872
The `Symbol` data structure knows how to, e.g. render its `Symbol#inspect` implementation [1]. To extract the underlying bytes associated with the `Symbol`, however, it needs an interpreter. But not a whole interpreter or any particular interpreter, just one that implements `Intern` [2].
All of these generics get monomorphized so there are no vtables or other indirection. Because it's unlikely you'll have more than one interpreter implementation in your program, there is no code bloat either.
[0]: https://github.com/artichoke/artichoke/blob/2d67d8537c1340f1...
[1]: https://artichoke.github.io/artichoke/spinoso_symbol/struct....
[2]: https://artichoke.github.io/artichoke/artichoke_core/intern/...
The `ai` ccTLD ran their own mail server at the root, so an address like `a@ai` was a valid email address.
They serve a website at the tld root: http://ai./
In the Rust definition of safety (mutable xor shared, no data races, memory safety, etc), treating the bits of a u8 as an i8 is safe and can be done with an `as` cast.
Growing pains of blowing up on HN lol, I do not have this written down yet, but I have a ticket to start documenting this [0].
The idea is to have a core set of traits [1] that when implemented allow an implementation to load an interpreter agnostic Ruby core and Ruby Standard Library.
There is currently only one interpreter that implements these traits, and it is backed by mruby. My ultimate goal is to move off of mruby to either an MRI-backed interpeter via rutie or a native Rust-implemented backend + VM + parser.
[0] https://github.com/artichoke/artichoke/issues/102 [1] https://artichoke.github.io/artichoke/artichoke_core/
One spec I know is missing is how capture groups should not be expanded into globals on `String#=~`. I'll file an issue [0].
I've implemented a runner that can skip known things that cause the spec to hang (e.g. Mutex specs since Artichoke has a single-threaded implementation of Mutex that deadlocks during the specs).
$ pushd spec-runner/vendor/ruby/language
$ cargo run --bin spec-runner **/*.rb
Passed 1078, skipped 35, not implemented 2, failed 476 specs.
$ popd; pushd spec-runner/vendor/ruby/core
$ cargo run --bin spec-runner **/*.rb
Passed 5412, skipped 998, not implemented 201, failed 8629 specs.
$ popd; pushd spec-runner/vendor/ruby/library
$ cargo run --bin spec-runner **/*.rb
Passed 0, skipped 22, not implemented 16, failed 3276 specs.
The library specs pass number is a bug in my spec runner. All packages added to Artichoke pass ruby/spec. Those packages are : delegate, forwardable, json, monitor, ostruct, set, srscan, and uri.Thanks for your interest in the project. You can track progress on this issue on GitHub [0]. Would love your help on this if you could lend it. :)
My expectation is that MRB_API can be implemented in a thread-safe way. The API manipulates the interpreter state (in the case of mruby, an `mrb_state`). The interpreter state itself and the implementation of the API can be thread safe or they can not be.
I don't think mruby even assumes the presence of threads on target systems, so it is completely reasonable that the implementation is not thread safe.
I wouldn't say all gems are unusable. I implemented a Rack-compatible application server in an early version of Artichoke that is capable of serving a Sinatra Rack app.
However, it may be possible to use `rubysys` in rutie as a base for an MRI compatible API: https://github.com/artichoke/artichoke/issues/88
I also made the website first ;) - https://www.burnfastburnbright.com/
:)
You are correct that `#[deny]` is what I want with Clippy.
The env_logger builder is something I didn't know about. The homepage for the docs does not even mention it - https://docs.rs/env_logger/0.6.0/env_logger/. I agree that I should depend on my own env variable, but should cargo not do the same?
result = input.each_cons(3).map do |left, _, right|
left + right
end
This maps over consecutive three-tuples in `input` and returns empty array for `len(input) < 3`.Edit: nevermind, boundary conditions are still special cases.