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

Namespace on read #2

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Namespace on read #2

wants to merge 1 commit into from

Conversation

tagomoris
Copy link
Owner

@tagomoris tagomoris commented Dec 28, 2023

https://bugs.ruby-lang.org/issues/19744

Features

  • Namespaces to require/load .rb files
  • Namespaces to require extensions
  • Supporting autoload
  • Reopening existing classes/modules
  • Defining methods on existing classes/modules
  • Eval code string in namespaces
  • Top-level methods in namespaces
  • Creating Procs in namespaces
  • Set the global namespace before running scripts
  • Defining singleton methods
  • Calling include/prepend on existing classes/modules
  • Newly added constant separation
  • Class instance variables (tests)
  • Global variable separation
  • Implicit reopen with class/module in namespaces on built-in classes/modules
  • Loading C libraries as dependencies of extensions in namespaces
  • Skip namespace separation about defining singleton methods on existing objects (tests)
  • Support remove_const, const_defined, const_added, rb_define_global_const, etc (tests)

Nothing to do

  • Class variables

Stretch

  • setup Bundler in namespaces

TODOs

  • Update cref and rb_cfunc_t to contain namespaces to eliminate rb_thread_t changes
  • Implement basename in C instead of calling rb_funcall in rb_namespace_local_extension
  • Update Namespace to contain rb_namespace_t directly instead of having Namespace::Entry
  • Support calling require in methods defined in namespace on non-namespaced threads
  • Global variable values in namespaces: $LOAD_PATH, $LOADED_FEATURES
  • Fix methods about Namespace itself
    • Namespace#inspect to show details (number? source location?)
    • Namespace#to_s (#name) to show shorter full class name <#Namespace:#3>::X::Y

Copy link

github-actions bot commented Jan 6, 2024

Try on Playground: https://ruby.github.io/play-ruby?run=8468437637
This is an automated comment by pr-playground.yml workflow.

@tagomoris tagomoris force-pushed the namespace-on-read branch 3 times, most recently from a9ac80a to 4569be7 Compare January 10, 2024 02:56
@tagomoris tagomoris changed the base branch from trunk to master January 11, 2024 13:21
@tagomoris tagomoris force-pushed the namespace-on-read branch 15 times, most recently from 0808a92 to f8d6727 Compare January 18, 2024 12:58
@tagomoris tagomoris force-pushed the namespace-on-read branch 2 times, most recently from 1818bf0 to 134281d Compare January 21, 2024 00:53
@tagomoris tagomoris force-pushed the namespace-on-read branch 2 times, most recently from 2837247 to d04ddec Compare February 8, 2024 06:57
@tagomoris tagomoris force-pushed the namespace-on-read branch 3 times, most recently from 2c0a137 to cfdfd76 Compare March 20, 2024 08:52
tagomoris pushed a commit that referenced this pull request Jul 29, 2024
When Ruby is built with ASAN and RUBY_FREE_AT_EXIT is enabled, the
following error occurs:

    READ of size 8 at 0x74c666610020 thread T0
        #0 0x593b6712ecc6 in RB_BUILTIN_TYPE include/ruby/internal/value_type.h:191:30
        #1 0x593b6712ecc6 in rb_gc_impl_shutdown_free_objects gc_impl.c:3208:17
        #2 0x593b6749a62e in ruby_vm_destruct vm.c:3133:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant