Skip to content

Commit 59dcc45

Browse files
committed
upd
1 parent 9373877 commit 59dcc45

8 files changed

Lines changed: 62 additions & 32 deletions

File tree

TODO

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@
222222
- [ ] 9. Return the result of calling f with (this) or (this, deep).
223223
- [ ] DefaultCloneBehavior(self, deep)
224224
- [ ] Let c = self.meta::class()
225-
- [ ] Let o = Create a new instance of c without evaluating the constructor
225+
- [ ] If c[[Constructor]].length == 0
226+
- [ ] Let o = new c()
227+
- [ ] Else
228+
- [ ] Let o = Create a new instance of c without evaluating the constructor
226229
- [ ] Copy instance fields from self to o
227230
- [ ] If deep=true, map the field value to val?.generic::clone()
228231
- [ ] Return o

src/overview/e4x.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ Depending on the inference type, XML literals may be used for constructing imple
2222

2323
```sx
2424
package zero {
25+
import whack.ds.UIComponent;
2526
import s = spark.components.*
2627
27-
public class Main extends whack.ds.UIComponent {
28+
public class Main extends UIComponent {
2829
public function Main() {
2930
super()
3031
final = (

src/overview/embed.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ External files are typically embedded in a structured way in the final program,
3636
3737
## Including statically
3838

39-
The user may embed files statically as either an UTF-8 encoded string, or `ByteArray`, rather than obtaining an URL.
39+
The user may embed files statically as either an UTF-8 encoded String, or `ByteArray`, or CSS node depending on the framework, rather than obtaining an URL.
4040

4141
```sx
42+
// String
4243
Embed("BeautySecrets.txt", type="text/plain")
44+
// ByteArray
4345
Embed("Hacker.bin", type="application/octet-stream")
46+
// For Whack, a whack.ds.StyleSheetNode
47+
Embed("AppBarSkin.css", type="text/css")
4448
```

src/overview/language-comparison/mxml.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ The MXML language, as part of the Apache Flex framework, was used for describing
66

77
```sx
88
package zero {
9+
import whack.ds.UIComponent;
910
import s = spark.components.*
1011
11-
public class HelloWorld extends whack.ds.UIComponent {
12+
public class HelloWorld extends UIComponent {
1213
public function HelloWorld() {
1314
super()
1415
final = (
@@ -72,7 +73,7 @@ Similarly to effects, callbacks that appear in E4X literals applied to the `whac
7273
Declare State variables using the `State` meta-data:
7374

7475
```sx
75-
public class Main extends whack.ds.UIComponent {
76+
public class Main extends UIComponent {
7677
[State]
7778
var counter : uint = 0;
7879
}
@@ -93,7 +94,7 @@ x = [...x, 10]
9394
In the top-level of a Whack DS component, declare bindables by using the `Bindable` meta-data. Bindables have certain use-cases, such as persisting a value across renders, and extracting DOM elements from certain tags (in which case the `bind` attribute is used).
9495

9596
```sx
96-
public class Main extends whack.ds.UIComponent {
97+
public class Main extends UIComponent {
9798
[Bindable]
9899
var button : org.w3.web.Button? = null;
99100
@@ -111,8 +112,8 @@ public class Main extends whack.ds.UIComponent {
111112
Obtain inherited contexts by using a Context variable.
112113

113114
```sx
114-
public class Main extends whack.ds.UIComponent {
115-
[Context("metro.context.Theme")]
115+
public class Main extends UIComponent {
116+
[Context("spark.contexts.Theme")]
116117
const theme;
117118
118119
public function Main() {

src/overview/language-comparison/reactjs.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ There are, however, many positive differences to ReactJS, such as memoization an
88

99
```sx
1010
package zero {
11+
import whack.ds.UIComponent;
1112
import s = spark.components.*
1213
13-
public class HelloWorld extends whack.ds.UIComponent {
14+
public class HelloWorld extends UIComponent {
1415
public function HelloWorld() {
1516
super()
1617
final = (
@@ -85,7 +86,9 @@ Unlike ReactJS, in Whack DS there is no risk of accessing an outdated state's va
8586

8687
```sx
8788
package spark.components {
88-
public class Ark extends whack.ds.UIComponent {
89+
import whack.ds.UIComponent;
90+
91+
public class Ark extends UIComponent {
8992
[State]
9093
var x : uint = 0;
9194
@@ -122,7 +125,9 @@ In Whack DS the concept of "refs" is called *bindables*.
122125

123126
```sx
124127
package spark.components {
125-
public class Ark extends whack.ds.UIComponent {
128+
import whack.ds.UIComponent;
129+
130+
public class Ark extends UIComponent {
126131
[Bindable]
127132
var button : org.w3.web.Button? = null;
128133
@@ -148,8 +153,8 @@ Note `.@x` is a meta-data attribute accessor for DOM elements.
148153
Using contexts results in `ContextReference.<T>` objects, although they are used as natural `Context`-annotated variables.
149154

150155
```sx
151-
public class View extends whack.ds.UIComponent {
152-
[Context("zero.context.Example")]
156+
public class View extends UIComponent {
157+
[Context("zero.contexts.Example")]
153158
const example;
154159
155160
public function View() {
@@ -166,7 +171,7 @@ public class View extends whack.ds.UIComponent {
166171
Props must be typed **tap \{\}**. It is not recommended to destructure Props.
167172

168173
```sx
169-
public class View extends whack.ds.UIComponent {
174+
public class View extends UIComponent {
170175
public function View(props : Props) {
171176
super()
172177
final = (

src/overview/whack_ds.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ Whack DS supports style sheets out of the box. Here is a simple example:
4040
Here is a little code snippet:
4141

4242
```sx
43-
package metro.components {
44-
public class TabBar extends whack.ds.UIComponent {
43+
package spark.components {
44+
import whack.ds.UIComponent;
45+
46+
public class TabBar extends UIComponent {
4547
var props : Props
4648
4749
public function TabBar(props : Props) {
@@ -63,9 +65,10 @@ Here's a slightly bigger code snippet for a linear second accumulator:
6365

6466
```sx
6567
package {
68+
import whack.ds.UIComponent;
6669
import whack.util.*
6770
68-
public class Clock extends whack.ds.UIComponent {
71+
public class Clock extends UIComponent {
6972
var props : Props ;
7073
[State]
7174
var mSecs : bigint? = null;
@@ -151,9 +154,10 @@ The `function` case allows tag attributes such as `bind` to specify a receiver t
151154

152155
```sx
153156
package zero.components {
157+
import whack.ds.UIComponent;
154158
import org.w3.web.Div;
155159
156-
public class Binding extends whack.ds.UIComponent {
160+
public class Binding extends UIComponent {
157161
[Bindable]
158162
var element : Div? = null;
159163
@@ -226,8 +230,10 @@ A component may be an alias by using the Alias meta-data, which specifies a Shoc
226230

227231
```sx
228232
package spark.components {
233+
import whack.ds.UIComponent;
234+
229235
[Alias("w::VGroup")]
230-
public class VGroup extends whack.ds.UIComponent {
236+
public class VGroup extends UIComponent {
231237
}
232238
}
233239
```
@@ -242,15 +248,16 @@ A component library typically provides an Application component so you do not ha
242248

243249
```sx
244250
package {
245-
import mx = metro.components.*;
251+
import whack.ds.UIComponent;
252+
import s = spark.components.*;
246253
247-
public class Main extends whack.ds.UIComponent {
254+
public class Main extends UIComponent {
248255
public function Main() {
249256
super()
250257
final = (
251-
<mx:Application>
258+
<s:Application>
252259
<w:EyeExp name="camera" size={37}/>
253-
</mx:Application>
260+
</s:Application>
254261
)
255262
}
256263
}

src/overview/whack_ds/mxml_like.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ The `key` attribute is reserved for uniquely identifying interpolated collection
3838

3939
```sx
4040
package zero.components {
41-
public class Ark extends whack.ds.UIComponent {
41+
import whack.ds.UIComponent;
42+
43+
public class Ark extends UIComponent {
4244
public function Ark() {
4345
super();
4446
final = (
@@ -64,7 +66,9 @@ If the style sheet is too large, it may be moved out of the ShockScript file; fo
6466

6567
```sx
6668
package zero.components {
67-
public class Ark extends whack.ds.UIComponent {
69+
import whack.ds.UIComponent;
70+
71+
public class Ark extends UIComponent {
6872
public function Ark() {
6973
super();
7074
final = (
@@ -127,7 +131,9 @@ For a component to support `<fx:Style>` tags, it simply needs to support a `styl
127131

128132
```sx
129133
package zero.components {
130-
public class Ark extends whack.ds.UIComponent {
134+
import whack.ds.UIComponent;
135+
136+
public class Ark extends UIComponent {
131137
public function Ark(props : Props) {
132138
super();
133139
final = (

src/serial.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ This feature may only be used with classes that are annotatated with either the
66

77
Variants of an algebraic data type do not need to specify the `Serial` or `XS` meta-data.
88

9-
The default behavior while deserializing into a class other than primitive types and certain global classes, unless defining a self-attached `fromJSON` or `fromXML` method, is roughly:
10-
11-
1. Create a new instance *o* of the class without evaluating the constructor
12-
2. Let *fields* = Each *o*\[*k*\] field that is not configured with the `skip="true"` option.
13-
3. Assign each field of *fields* to the respective data document field with the appropriate parsing of the field's data type, applying any configured rename.
14-
4. Return *o*
9+
The default behavior while deserializing into a class *c* other than primitive types and certain global classes, unless defining a self-attached `fromJSON` or `fromXML` method, is roughly:
10+
11+
1. If *c*<i>[[Constructor]]</i>.length == 0
12+
1. Let o = new *c*()
13+
2. Else
14+
1. Let o = Create a new instance of *c* without evaluating the constructor
15+
3. Let *fields* = Each *o*\[*k*\] field that is not configured with the `skip="true"` option.
16+
4. Assign each field of *fields* to the respective data document field with the appropriate parsing of the field's data type, applying any configured rename.
17+
5. Return *o*
1518

1619
Simple enums, including Flags enums, are serialized and deserialized in a different way from algebraic enums.
1720

0 commit comments

Comments
 (0)