# requires Ruby 3.3 or newer
body = proc { |x| x * 2 }
# *** before: ***
wrapped_old = lambda(&body) # a Proc was silently accepted, arity was not
#checked
# *** in version 3.3: ***
begin
lambda(&body) # ArgumentError: tried to create a Proc from a non-literal Proc
rescue ArgumentError => e
puts e.message
end
strict = lambda { |x| x * 2 } # only a literal block is accepted
puts strict.call(3)