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

Add constant definition APIs to artichoke-core #526

Merged
merged 2 commits into from
Feb 17, 2020

Conversation

lopopolo
Copy link
Member

@lopopolo lopopolo commented Feb 17, 2020

DefineConstant exposes APIs for defining global constants as well as
constants on class or module values.

Use them in extn global constants and Random::DEFAULT. This commit
removes the macro-based const definition approach in extn::init.

Related to GH-442.
Fixes GH-27.

`DefineConstant` exposes APIs for defining global constants as well as
constants on class or module values.

Use them in extn global constants and `Random::DEFAULT`. This commit
removes the macro-based const definition approach in `extn::init`.
@lopopolo lopopolo added B-mruby A-core Area: Core traits and interpreter-agnostic Ruby Core and Ruby stdlib implementations. A-ruby-core Area: Ruby Core types. labels Feb 17, 2020
@lopopolo lopopolo merged commit 2cf046a into master Feb 17, 2020
@lopopolo lopopolo deleted the define-constant-interp-apis branch February 17, 2020 23:52
lopopolo added a commit that referenced this pull request Feb 22, 2020
`Float` and `Regexp` both define constants by string formatting `i64`s
and `f64`s  into a code string with `format!` and evaling it on the
interpreter. This is not ideal.

GH-526 added constant definition APIs to `artichoke-core` and
implemented them for `artichoke-backend`. This commit wires it up in
`extn`. The resulting code has more localized failures - errors are
reported on the granularity of defining a single constant. The constant
values are converted into proper `Value`s directly from their native
Rust form.

See also GH-27, the issue referenced by both of the TODOs (the TODO in
`float.rs` refers to the issue number from lopopolo/ferrocarril before
it was migrated to the artichoke/artichoke repo).
@lopopolo lopopolo added the B-mruby Backend: Implementation of artichoke-core using mruby. label Aug 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-core Area: Core traits and interpreter-agnostic Ruby Core and Ruby stdlib implementations. A-ruby-core Area: Ruby Core types. B-mruby Backend: Implementation of artichoke-core using mruby.
Development

Successfully merging this pull request may close these issues.

Add APIs on class::Spec and module::Spec for defining constants
1 participant