We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
this
this in lambdas is environment object, but this is problematic because it don't work on objects literals:
lips> ((. (object :foo (lambda () this)) 'foo)) #<environment> lips> (define x (object :foo (lambda () this))) lips> (x.foo) #<environment> lips> (new (lambda () this)) #<instance>
so it only work on new operator. It would be nice if it works on any objects.
The text was updated successfully, but these errors were encountered:
Even in class methods this is environment.
(let* ((a (class Object (constructor (lambda (self) (print this) (set! self.x '(1 2 3)))) (run (lambda (self) (print this) (for-each print self.x))))) (b (new a))) (b.run)) #<environment> #<environment> 1 2 3
Maybe solution would be to always use self and not document this at all.
this is werid:
lips> (new (lambda () (print this) (for-each print '(1 2 3)))) #<lambda> 1 2 3 #<instance>
for-each use this to get instance of map, but this is not a problem.
And this:
lips> (define x (object :foo (lambda () this))) lips> (x.foo.call x) &(:foo #<procedure>)
The problem may be that the function is unbind before call.
Sorry, something went wrong.
fix context in methods of plain objects #103
34c85a0
fix this in new lambda #103
3f6867e
Fix repr of this when new lambda (it's now properly identiefied as instance)
another unit tests for #103
788d4d8
one more unit test for #103
e64a0ed
No branches or pull requests
this
in lambdas is environment object, but this is problematic because it don't work on objects literals:so it only work on new operator. It would be nice if it works on any objects.
The text was updated successfully, but these errors were encountered: