Skip to content

Commit d931ee5

Browse files
nomeatamergify[bot]
authored andcommitted
The big Motoko renaming PR (#801)
* ActorScript → Motoko * actorScript → motoko * `asc` → `.moc` * `.as` → `.mo` * `as-ld` → `mo-ld` …and so on.
1 parent c0ea492 commit d931ee5

File tree

920 files changed

+2230
-2230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

920 files changed

+2230
-2230
lines changed

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# .gitattributes file which reclassifies `.as` files as Swift:
2-
*.as linguist-language=Swift
1+
# .gitattributes file which reclassifies `.mo` files as Swift:
2+
*.mo linguist-language=Swift

Building.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Installation using Nix
22

3-
To install the `asc` binary into your nix environment, use
3+
To install the `moc` binary into your nix environment, use
44

55
```
6-
$ nix-env -i -f . -A asc
6+
$ nix-env -i -f . -A moc
77
```
88

99
## Development using Nix
@@ -19,9 +19,9 @@ $ nix-shell
1919
```
2020
within this shell you can run
2121
* `make` in `src/` to build all binaries,
22-
* `make asc` in `src/` to build just the `asc` binary,
23-
* `make DUNE_OPTS=--watch asc` to keep rebuilding as source files are changing
24-
* `make` in `rts/` to build the ActorScript runtime
22+
* `make moc` in `src/` to build just the `moc` binary,
23+
* `make DUNE_OPTS=--watch moc` to keep rebuilding as source files are changing
24+
* `make` in `rts/` to build the Motoko runtime
2525
* `make` in `test/` to run the test suite.
2626

2727
This invokes `dune` under the hood, which will, as a side effect, also create
@@ -54,11 +54,11 @@ installing all required tools without nix is out of scope).
5454
nix-env -i -f . -A wabt
5555
nix-env -i -f . -A dvm
5656
```
57-
* Building the ActorScript runtime without nix is tricky. But you can run
57+
* Building the Motoko runtime without nix is tricky. But you can run
5858
```
5959
nix-shell --run 'make -C rts'
6060
```
61-
to get `rts/as-rts.wasm`.
61+
to get `rts/mo-rts.wasm`.
6262

6363

6464
## Create a coverage report
@@ -71,16 +71,16 @@ https://github.com/ocaml/dune/issues/57 to see when a coverage report is viable
7171
1. Build with profiling (TODO: How to do with dune)
7272
```
7373
make -C src clean
74-
make BUILD=p.native -C src asc
74+
make BUILD=p.native -C src moc
7575
```
76-
2. Run `asc` as normal, e.g.
76+
2. Run `moc` as normal, e.g.
7777
```
78-
./src/asc -c foo.as -o foo.wasm
78+
./src/moc -c foo.mo -o foo.wasm
7979
```
8080
this should dump a `gmon.out` file in the current directory.
8181
3. Create the report, e.g. using
8282
```
83-
gprof --graph src/asc
83+
gprof --graph src/moc
8484
```
8585
(Note that you have to _run_ this in the directory with `gmon.out`, but
8686
_pass_ it the path to the binary.)

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# ActorScript
1+
# Motoko
22

33
A simple language for writing Dfinity actors.
44

55
## User Documentation & Samples
66

7-
* [Overview slides](https://hydra.dfinity.systems/job/dfinity-ci-build/actorscript/users-guide/latest/download/1/as-slides.html) ([sources](guide/as-slides.md)).
7+
* [Overview slides](https://hydra.dfinity.systems/job/dfinity-ci-build/motoko/users-guide/latest/download/1/as-slides.html) ([sources](guide/as-slides.md)).
88
* [Draft (incomplete) manual](guide/guide.md).
99
* [Prelude](src/prelude/prelude.ml).
1010
* Beginnings of [standard library](stdlib).

ci.nix

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ let
1010
in
1111
linux // {
1212
darwin = darwin.all-systems-go;
13-
asc-tar-x86_64-darwin = darwin.asc-tar;
14-
asc-tar-x86_64-linux = linux.asc-tar;
13+
moc-tar-x86_64-darwin = darwin.moc-tar;
14+
moc-tar-x86_64-linux = linux.moc-tar;
1515
all-systems-go = inject-rev (nixpkgs.releaseTools.aggregate {
1616
name = "all-systems-go";
1717
constituents = [

default.nix

+46-46
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ in
201201

202202
rec {
203203
rts = stdenv.mkDerivation {
204-
name = "asc-rts";
204+
name = "moc-rts";
205205

206206
src = subpath ./rts;
207207
nativeBuildInputs = [ nixpkgs.makeWrapper ];
@@ -221,56 +221,56 @@ rec {
221221

222222
installPhase = ''
223223
mkdir -p $out/rts
224-
cp as-rts.wasm $out/rts
224+
cp mo-rts.wasm $out/rts
225225
'';
226226
};
227227

228-
asc-bin = stdenv.mkDerivation {
229-
name = "asc-bin";
228+
moc-bin = stdenv.mkDerivation {
229+
name = "moc-bin";
230230

231231
src = subpath ./src;
232232

233233
buildInputs = commonBuildInputs;
234234

235235
buildPhase = ''
236-
make DUNE_OPTS="--display=short --profile release" asc as-ld
236+
make DUNE_OPTS="--display=short --profile release" moc mo-ld
237237
'';
238238

239239
installPhase = ''
240240
mkdir -p $out/bin
241-
cp --verbose --dereference asc as-ld $out/bin
241+
cp --verbose --dereference moc mo-ld $out/bin
242242
'';
243243
};
244244

245-
asc = nixpkgs.symlinkJoin {
246-
name = "asc";
247-
paths = [ asc-bin rts ];
245+
moc = nixpkgs.symlinkJoin {
246+
name = "moc";
247+
paths = [ moc-bin rts ];
248248
buildInputs = [ nixpkgs.makeWrapper ];
249249
postBuild = ''
250-
wrapProgram $out/bin/asc \
251-
--set-default ASC_RTS "$out/rts/as-rts.wasm"
250+
wrapProgram $out/bin/moc \
251+
--set-default MOC_RTS "$out/rts/mo-rts.wasm"
252252
'';
253253
};
254254

255-
asc-tar = nixpkgs.symlinkJoin {
256-
name = "asc-tar";
257-
paths = [ asc-bin rts didc ];
255+
moc-tar = nixpkgs.symlinkJoin {
256+
name = "moc-tar";
257+
paths = [ moc-bin rts didc ];
258258
postBuild = ''
259-
tar -chf $out/asc.tar -C $out bin/asc rts/as-rts.wasm bin/didc
259+
tar -chf $out/moc.tar -C $out bin/moc rts/mo-rts.wasm bin/didc
260260
mkdir -p $out/nix-support
261-
echo "file bin $out/asc.tar" >> $out/nix-support/hydra-build-products
261+
echo "file bin $out/moc.tar" >> $out/nix-support/hydra-build-products
262262
'';
263263
};
264264

265265
lsp-int = haskellPackages.callCabal2nix "lsp-int" test/lsp-int { };
266266

267-
qc-actorscript = haskellPackages.callCabal2nix "qc-actorscript" test/random { };
267+
qc-motoko = haskellPackages.callCabal2nix "qc-motoko" test/random { };
268268

269269
tests = stdenv.mkDerivation {
270270
name = "tests";
271271
src = subpath ./test;
272272
buildInputs =
273-
[ asc
273+
[ moc
274274
didc
275275
deser
276276
ocaml_wasm
@@ -283,7 +283,7 @@ rec {
283283
js-user-library
284284
dvm
285285
drun
286-
qc-actorscript
286+
qc-motoko
287287
lsp-int
288288
esm
289289
] ++
@@ -292,19 +292,19 @@ rec {
292292
buildPhase = ''
293293
patchShebangs .
294294
${llvmEnv}
295-
export ASC=asc
296-
export AS_LD=as-ld
295+
export MOC=moc
296+
export MO_LD=mo-ld
297297
export DIDC=didc
298298
export DESER=deser
299299
export ESM=${esm}
300300
export JS_USER_LIBRARY=${js-user-library}
301-
asc --version
301+
moc --version
302302
make parallel
303-
qc-actorscript${nixpkgs.lib.optionalString (replay != 0)
303+
qc-motoko${nixpkgs.lib.optionalString (replay != 0)
304304
" --quickcheck-replay=${toString replay}"}
305305
cp -R ${subpath ./test/lsp-int/test-project} test-project
306306
find ./test-project -type d -exec chmod +w {} +
307-
lsp-int ${as-ide}/bin/as-ide ./test-project
307+
lsp-int ${mo-ide}/bin/mo-ide ./test-project
308308
'';
309309

310310
installPhase = ''
@@ -328,28 +328,28 @@ rec {
328328
'';
329329
};
330330

331-
as-ide = stdenv.mkDerivation {
332-
name = "as-ide";
331+
mo-ide = stdenv.mkDerivation {
332+
name = "mo-ide";
333333

334334
src = subpath ./src;
335335

336336
buildInputs = commonBuildInputs;
337337

338338
buildPhase = ''
339-
make DUNE_OPTS="--display=short --profile release" as-ide
339+
make DUNE_OPTS="--display=short --profile release" mo-ide
340340
'';
341341

342342
installPhase = ''
343343
mkdir -p $out/bin
344-
cp --verbose --dereference as-ide $out/bin
344+
cp --verbose --dereference mo-ide $out/bin
345345
'';
346346
};
347347

348348
samples = stdenv.mkDerivation {
349349
name = "samples";
350350
src = subpath ./samples;
351351
buildInputs =
352-
[ asc
352+
[ moc
353353
didc
354354
ocaml_wasm
355355
nixpkgs.wabt
@@ -362,16 +362,16 @@ rec {
362362

363363
buildPhase = ''
364364
patchShebangs .
365-
export ASC=asc
365+
export MOC=moc
366366
make all
367367
'';
368368
installPhase = ''
369369
touch $out
370370
'';
371371
};
372372

373-
js = asc-bin.overrideAttrs (oldAttrs: {
374-
name = "asc.js";
373+
js = moc-bin.overrideAttrs (oldAttrs: {
374+
name = "moc.js";
375375

376376
buildInputs = commonBuildInputs ++ [
377377
nixpkgs.ocamlPackages.js_of_ocaml
@@ -381,12 +381,12 @@ rec {
381381
];
382382

383383
buildPhase = ''
384-
make asc.js
384+
make moc.js
385385
'';
386386

387387
installPhase = ''
388388
mkdir -p $out
389-
cp -v asc.js $out
389+
cp -v moc.js $out
390390
cp -vr ${rts}/rts $out
391391
'';
392392

@@ -470,15 +470,15 @@ rec {
470470
'';
471471
doCheck = true;
472472
checkInputs = [
473-
asc
473+
moc
474474
nixpkgs.python
475475
];
476476
checkPhase = ''
477-
make ASC=${asc}/bin/asc alltests
477+
make MOC=${moc}/bin/moc alltests
478478
'';
479479
installPhase = ''
480480
mkdir -p $out
481-
tar -rf $out/stdlib.tar -C $src *.as
481+
tar -rf $out/stdlib.tar -C $src *.mo
482482
mkdir -p $out/nix-support
483483
echo "report stdlib $out/stdlib.tar" >> $out/nix-support/hydra-build-products
484484
'';
@@ -525,15 +525,15 @@ rec {
525525
name = "produce-exchange";
526526
src = subpath ./stdlib;
527527
buildInputs = [
528-
asc
528+
moc
529529
];
530530

531531
doCheck = true;
532532
buildPhase = ''
533-
make ASC=asc OUTDIR=_out _out/ProduceExchange.wasm
533+
make MOC=moc OUTDIR=_out _out/ProduceExchange.wasm
534534
'';
535535
checkPhase = ''
536-
make ASC=asc OUTDIR=_out _out/ProduceExchange.out
536+
make MOC=moc OUTDIR=_out _out/ProduceExchange.out
537537
'';
538538
installPhase = ''
539539
mkdir -p $out
@@ -544,8 +544,8 @@ rec {
544544
all-systems-go = nixpkgs.releaseTools.aggregate {
545545
name = "all-systems-go";
546546
constituents = [
547-
asc
548-
as-ide
547+
moc
548+
mo-ide
549549
js
550550
didc
551551
deser
@@ -563,16 +563,16 @@ rec {
563563

564564
shell = if export-shell then nixpkgs.mkShell {
565565
#
566-
# Since building asc, and testing it, are two different derivations in we
566+
# Since building moc, and testing it, are two different derivations in we
567567
# have to create a fake derivation for `nix-shell` that commons up the
568568
# build dependencies of the two to provide a build environment that offers
569-
# both, while not actually building `asc`
569+
# both, while not actually building `moc`
570570
#
571571

572572
buildInputs =
573-
let dont_build = [ asc didc deser ]; in
573+
let dont_build = [ moc didc deser ]; in
574574
nixpkgs.lib.lists.unique (builtins.filter (i: !(builtins.elem i dont_build)) (
575-
asc-bin.buildInputs ++
575+
moc-bin.buildInputs ++
576576
js.buildInputs ++
577577
rts.buildInputs ++
578578
didc.buildInputs ++

design/FAQ.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ An actor is instantiated as a separate wasm instance, with isolated state. Class
66
77
At the moment, anywhere - they get compiled to async message sends to the enclosing (perhaps implicit) actor that return a promise. You might, however, not be able to await the result unless you are in an outer async context! But you could pass in into another async block that can await it.
88

9-
> 3. What kinds of datatypes are permitted to be declared with the `share` qualifier; and why some but not others (what’s the source of the distinction, and its role in writing actorscript-based systems)
9+
> 3. What kinds of datatypes are permitted to be declared with the `share` qualifier; and why some but not others (what’s the source of the distinction, and its role in writing motoko-based systems)
1010
1111
Shared means transmittable without losing identity, essentially. So scalars, immutable data, option of shared, shared (immutable objects), shared functions and actor references can be sent/received, but nothing else that might contain or close over mutable state. That's the idea, assuming it isn't broken. Not all restrictions are currently checked (i.e. escape of shared state into actors and shared functions for instance.) Note that serialization is mostly by value, apart from actors and shared functions, which are by reference, so identity can't be preserved for most values, ruling out them containing state.
1212

0 commit comments

Comments
 (0)