aboutsummaryrefslogtreecommitdiff
path: root/lib/object.nom
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2018-07-18 01:27:56 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2018-07-18 01:28:17 -0700
commitd5cfaa37be9e278c44a25ef448a071390597306e (patch)
tree7fbe78b5153bb9c761c283533943ab80da3a1844 /lib/object.nom
parentc7c657d38f999901225b33482ef3a15994526feb (diff)
Upgrading to version 2.3 (main change: "=" instead of "<-" for
assignment)
Diffstat (limited to 'lib/object.nom')
-rw-r--r--lib/object.nom20
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/object.nom b/lib/object.nom
index d41557b..cb5cd3c 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -1,33 +1,29 @@
-#!/usr/bin/env nomsu -V2.2.4.3
+#!/usr/bin/env nomsu -V2.3.4.3
#
This file contains the implementation of an Object-Oriented programming system.
use "core"
-
compile [@, me] to (Lua value "self")
compile [method %actions %body] to:
- %lua <- (compile as (action %actions %body))
+ %lua = (compile as (action %actions %body))
add free vars ((% as lua id) for % in %actions) to %lua
declare locals in %lua
for % in %actions:
to %lua write "\nclass.\(% as lua id) = \(% as lua id)"
return (..)
- Lua ".."
- do -- Method: \(%actions.(1).stub)
- \%lua
- end
+ Lua "do -- Method: \(%actions.(1).stub)\n \%lua\nend"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parse [as %instance %body] as (..)
result of:
- %old_self <- (me)
- (me) <- %instance
+ %old_self = (me)
+ (me) = %instance
try %body and if it barfs %msg:
- (me) <- %old_self
+ (me) = %old_self
barf %msg
- ..or if it succeeds: (me) <- %old_self
+ ..or if it succeeds: (me) = %old_self
compile [object %classname extends %parent %class_body] to (..)
Lua ".."
@@ -58,4 +54,4 @@ compile [object %classname extends %parent %class_body] to (..)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
parse [object %classname %class_body] as (..)
- object %classname extends (nil) %class_body
+ object %classname extends (nil) %class_body \ No newline at end of file