Project

General

Profile

Actions

Bug #19345

closed

Class variable access from top-level inappropriate error

Added by luke-gru (Luke Gruber) over 2 years ago. Updated over 2 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:111822]

Description

I was looking at doing something like this:

set_cvar = EnvUtil.labeled_class("SetCVar") do
  def self.set(val)
    @@a = val
  end
end
set_cvar.set(1) # fill write cache
set_cvar.freeze
set_cvar.set(2) # hit write cache, but should check frozen status

while working on a ruby issue (https://github.com/ruby/ruby/pull/7124) and I ran into an issue.
This code above gives the error "class variable access from toplevel (RuntimeError)"

Is this a bug or how it's supposed to work? The error is being raised in function vm_get_cvar_base.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0