You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The DOM construction mechanisms depend on being able to hang things into a tree-like structure. So, one needs to find the reference of the parent context to hang to. For example, to enable the following:
lethtml=div{span("hello world")}
The span call needs to be connected somehow to the parent div call to build a tree.
Alternatives considered
Here are some of the ideas that were thrown before:
Implicit
In this formulation, the expansion would implicitly include the this binding. So, a { ... } would be equivalent to a.call(function { ... }).
lethtml=div{span("hello world"){}}
this method resolution
In this formulation, the resolution of methods looks first for the presence in the this object for function calls before looking at the local scope and later at the global scope. e.g. a { b() } is equivalent to ```a(function() { (b in this ? this.b : b)() }).
For example:
lethtml=div{// "span" would first be looked at 'this' before looking at the global scope
span {}}
This may be isomorphic to the equivalency a { b() } to a(function() { with (this) { b() } })
bind operator
In this formulation, the expansion would be simply a { ... } to a(function() { ... }) and this would be passed via the bind operator
let html=div{
::div {
::span {
::p("hello world")}}}
special character
In this formulation, we would pick a special syntax space to make the distinction between the this binding and regular function calls.
lethtml=<div>{<div>{<span>{<p>("hello world")
}}}
The text was updated successfully, but these errors were encountered:
Introduction
The DOM construction mechanisms depend on being able to hang things into a tree-like structure. So, one needs to find the reference of the parent context to hang to. For example, to enable the following:
The
span
call needs to be connected somehow to the parentdiv
call to build a tree.Alternatives considered
Here are some of the ideas that were thrown before:
Implicit
In this formulation, the expansion would implicitly include the
this
binding. So,a { ... }
would be equivalent toa.call(function { ... })
.this
method resolutionIn this formulation, the resolution of methods looks first for the presence in the
this
object for function calls before looking at the local scope and later at the global scope. e.g.a { b() }
is equivalent to ```a(function() { (b in this ? this.b : b)() }).For example:
This may be isomorphic to the equivalency
a { b() }
toa(function() { with (this) { b() } })
bind operator
In this formulation, the expansion would be simply
a { ... }
toa(function() { ... })
andthis
would be passed via the bind operatorspecial character
In this formulation, we would pick a special syntax space to make the distinction between the
this
binding and regular function calls.The text was updated successfully, but these errors were encountered: