The Crystal Programming Language Forum

What is this sorcery?

Struct is defined in https://github.com/crystal-lang/crystal/blob/master/src/struct.cr as

struct Struct
end

and then you have

% crystal eval 'p {{ Struct.superclass }}'
Value
% crystal eval 'struct S; end; p {{ S.superclass }}'
Struct
1 Like

All of the essential types are defined by the compiler before reading the prelude files:

That said, it wouldn’t hurt if those definitions do struct Struct < Value, but in reality they are reopening said types.

Aaahhh, going to read that file.