Commit Graph

3 Commits

Author SHA1 Message Date
Bob Nystrom
ef93496fd4 fix: remove default constructors and require explicit construct new() for all user classes
The compiler no longer auto-generates a default `new()` constructor for classes. All classes must now explicitly define `construct new() {}` to be instantiable. This change removes the `createDefaultConstructor` function from the compiler, eliminates the `return_this` primitive used by Object's default initializer, and adds explicit constructors to all test and example classes. Core metaclasses (Bool, Class, Null, Num, Object, Range, Sequence) now correctly reject `new()` calls with runtime errors.
2015-09-01 15:16:04 +00:00
Bob Nystrom
6187f7c3d8 style: convert Cthulu and Lovecraft class methods to single-line expression bodies 2015-02-19 14:32:46 +00:00
Paul Woolcock
4e73f997a4 feat: add example demonstrating module import with Cthulu and Lovecraft classes
Add two new Wren source files under example/import-module/ showing how to import and use a module. The cthulu.wren file defines a Cthulu class with a message method returning a Lovecraftian phrase, while lovecraft.wren imports the Cthulu class, instantiates it, and prints the message via IO.print.
2015-02-18 16:39:31 +00:00