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
[PRISM] allow enabling Prism via flag or env var #9115
Conversation
47fd1eb
to
2e763ce
Compare
Enable Prism using either --prism ruby --prism test.rb or via env var RUBY_PRISM=1 ruby test.rb
2e763ce
to
72e3d48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just one q about if we can reduce dependencies
@@ -13,6 +13,7 @@ | |||
#include "internal/gc.h" | |||
#include "shape.h" | |||
#include "vm_core.h" | |||
#include "prism/prism.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way we can do this without adding this dependency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, as long as rb_iseq_new_main_prism
takes a pm_string_t
and pm_options_t
, we need those types available.
Maybe we can hide the types behind a void *
or a VALUE
? Would that be better?
I looked into if we could move this to prism_compile.c
instead of defining this in iseq.c
, but prism_compile.c
doesn't know about iseq_alloc
.
Also, it looks like iseq.c
already depends on prism/prism.h
via prism_compile.h
.
Is the idea in reducing dependencies to decouple things, or is the worry this will make compile times longer since changes in prism will require a recompile on all things that use iseq.h
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The smell is actually a bit of common.mk
. Historically we've been trying to keep the dependencies to a minimum to make it easier to pull Prism out if the Ruby core team ever decides to do something like that. But I hink in this case, you're right, it's not really worth the void *
casting.
@jemmaissroff @HParker Hey, this is a user-facing feature. Please file a ticket on bugs.ruby-lang.org and get matz's approval to merge it. Please revert it for now. cc/ @kddnewton |
Command line option and Environmental variables need to discuss naming and get approval from Matz. |
@HParker Thank you! Sorry for the hassle. I think we should discuss the following before merging it, for example.
|
@HParker Thank you for your quick action ❤️ |
Enable Prism using either --prism
or via env var
This uses Prism to load the first file and files loaded with
require
. This does not use Prism foreval
, but that can be done in a followup.