Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named import sugar #420

Merged
merged 1 commit into from
May 16, 2019
Merged

Named import sugar #420

merged 1 commit into from
May 16, 2019

Conversation

rossberg
Copy link
Contributor

For more natural looks, allow declarations of the form

import X = "..."

as sugar for

let X = import "...";

analogous to other forms.

@rossberg rossberg requested a review from crusso May 16, 2019 08:56
@nomeata
Copy link
Collaborator

nomeata commented May 16, 2019

Oh, we don’t have that yet? I fully agree and I think we always wanted that.

let L = (import "serverLang.as");
let Model = (import "serverModel.as");
let Result = (import "../../result.as");
import P = "../../prelude.as";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be

import P "../../prelude.as"

now, i.e. without the =, just like for actor?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, judging from the parser we can actually write

let a = actor { … } // 1
actor a { … }  // 2
actor a = { … } // 3

I did not know that :-/

Do we need both 2 and 3? (At least I got used to 2 and am surprised that 3 works as well).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not happy with having both. The only place where you occasionally need the third form is with class, since it's not syntactically possible to name self otherwise.

My functional programmer mind would prefer removing (2) and sticking to (3), but I suppose curly braces folks expect (2)...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our users in stdlib/ wildly mix 2 and 3 for class, 2 for actor, don't have named new, don’t have object, and wildly mix 2 and 3 for func.

Just to avoid us spending too much time on such discussions I will refrain from arguing for either 2 or 3 (but express a preference to having just one of them) :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but independent from this PR, I presume.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, absolutely

@rossberg rossberg merged commit ef2f494 into master May 16, 2019
@rossberg rossberg deleted the import branch May 16, 2019 09:48
Copy link
Contributor

@crusso crusso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with this.

dfinity-bot added a commit that referenced this pull request Nov 1, 2022
## Changelog for motoko-base:
Branch: next-moc
Commits: [dfinity/motoko-base@fac5e2c5...17535324](dfinity/motoko-base@fac5e2c...1753532)

* [`c2b221ae`](dfinity/motoko-base@c2b221a) Add Examples for class methods in Buffer ([dfinity/motoko-base⁠#420](https://togithub.com/dfinity/motoko-base/issues/420))
mergify bot pushed a commit that referenced this pull request Nov 1, 2022
## Changelog for motoko-base:
Branch: next-moc
Commits: [dfinity/motoko-base@fac5e2c5...17535324](dfinity/motoko-base@fac5e2c...1753532)

* [`c2b221ae`](dfinity/motoko-base@c2b221a) Add Examples for class methods in Buffer ([dfinity/motoko-base⁠#420](https://togithub.com/dfinity/motoko-base/issues/420))
dfinity-bot added a commit that referenced this pull request May 24, 2023
## Changelog for candid:
Branch: master
Commits: [dfinity/candid@f7166f47...9301221a](dfinity/candid@f7166f4...9301221)

* [`51c00478`](dfinity/candid@51c0047) spec: support composite query ([dfinity/candid⁠#420](https://togithub.com/dfinity/candid/issues/420))
* [`74869398`](dfinity/candid@7486939) fix recursion test ([dfinity/candid⁠#425](https://togithub.com/dfinity/candid/issues/425))
* [`eb31f888`](dfinity/candid@eb31f88) Use Arc<Type> with `arc_type` feature ([dfinity/candid⁠#407](https://togithub.com/dfinity/candid/issues/407))
* [`b9d6cbff`](dfinity/candid@b9d6cbf) support custom candid path for export_service ([dfinity/candid⁠#421](https://togithub.com/dfinity/candid/issues/421))
* [`fa29c70d`](dfinity/candid@fa29c70) Add config options for Rust binding ([dfinity/candid⁠#422](https://togithub.com/dfinity/candid/issues/422))
* [`f31396d8`](dfinity/candid@f31396d) Bump webpack from 5.24.4 to 5.76.0 in /tools/ui ([dfinity/candid⁠#413](https://togithub.com/dfinity/candid/issues/413))
* [`9301221a`](dfinity/candid@9301221) release ([dfinity/candid⁠#430](https://togithub.com/dfinity/candid/issues/430))
mergify bot pushed a commit that referenced this pull request May 24, 2023
## Changelog for candid:
Branch: master
Commits: [dfinity/candid@f7166f47...9301221a](dfinity/candid@f7166f4...9301221)

* [`51c00478`](dfinity/candid@51c0047) spec: support composite query ([dfinity/candid⁠#420](https://togithub.com/dfinity/candid/issues/420))
* [`74869398`](dfinity/candid@7486939) fix recursion test ([dfinity/candid⁠#425](https://togithub.com/dfinity/candid/issues/425))
* [`eb31f888`](dfinity/candid@eb31f88) Use Arc<Type> with `arc_type` feature ([dfinity/candid⁠#407](https://togithub.com/dfinity/candid/issues/407))
* [`b9d6cbff`](dfinity/candid@b9d6cbf) support custom candid path for export_service ([dfinity/candid⁠#421](https://togithub.com/dfinity/candid/issues/421))
* [`fa29c70d`](dfinity/candid@fa29c70) Add config options for Rust binding ([dfinity/candid⁠#422](https://togithub.com/dfinity/candid/issues/422))
* [`f31396d8`](dfinity/candid@f31396d) Bump webpack from 5.24.4 to 5.76.0 in /tools/ui ([dfinity/candid⁠#413](https://togithub.com/dfinity/candid/issues/413))
* [`9301221a`](dfinity/candid@9301221) release ([dfinity/candid⁠#430](https://togithub.com/dfinity/candid/issues/430))
dfinity-bot added a commit that referenced this pull request Jun 25, 2023
## Changelog for musl-wasi:
Branch: main
Commits: [WebAssembly/wasi-libc@aecd368c...bd950eb1](WebAssembly/wasi-libc@aecd368...bd950eb)

* [`5862047a`](WebAssembly/wasi-libc@5862047) Adjust Makefile for LLVM trunk (17) as of 2023-06-18 ([WebAssembly/wasi-libc⁠#422](https://togithub.com/WebAssembly/wasi-libc/issues/422))
* [`7018e24d`](WebAssembly/wasi-libc@7018e24) Fix a use-after-free bug for detached threads ([WebAssembly/wasi-libc⁠#420](https://togithub.com/WebAssembly/wasi-libc/issues/420))
* [`43e71239`](WebAssembly/wasi-libc@43e7123) Improve `README.md` ([WebAssembly/wasi-libc⁠#425](https://togithub.com/WebAssembly/wasi-libc/issues/425))
* [`bd950eb1`](WebAssembly/wasi-libc@bd950eb) Use -fno-strict-aliasing for emmalloc ([WebAssembly/wasi-libc⁠#424](https://togithub.com/WebAssembly/wasi-libc/issues/424))
dfinity-bot added a commit that referenced this pull request Jun 26, 2023
## Changelog for musl-wasi:
Branch: main
Commits: [WebAssembly/wasi-libc@aecd368c...bd950eb1](WebAssembly/wasi-libc@aecd368...bd950eb)

* [`5862047a`](WebAssembly/wasi-libc@5862047) Adjust Makefile for LLVM trunk (17) as of 2023-06-18 ([WebAssembly/wasi-libc⁠#422](https://togithub.com/WebAssembly/wasi-libc/issues/422))
* [`7018e24d`](WebAssembly/wasi-libc@7018e24) Fix a use-after-free bug for detached threads ([WebAssembly/wasi-libc⁠#420](https://togithub.com/WebAssembly/wasi-libc/issues/420))
* [`43e71239`](WebAssembly/wasi-libc@43e7123) Improve `README.md` ([WebAssembly/wasi-libc⁠#425](https://togithub.com/WebAssembly/wasi-libc/issues/425))
* [`bd950eb1`](WebAssembly/wasi-libc@bd950eb) Use -fno-strict-aliasing for emmalloc ([WebAssembly/wasi-libc⁠#424](https://togithub.com/WebAssembly/wasi-libc/issues/424))
mergify bot pushed a commit that referenced this pull request Jun 26, 2023
## Changelog for musl-wasi:
Branch: main
Commits: [WebAssembly/wasi-libc@aecd368c...bd950eb1](WebAssembly/wasi-libc@aecd368...bd950eb)

* [`5862047a`](WebAssembly/wasi-libc@5862047) Adjust Makefile for LLVM trunk (17) as of 2023-06-18 ([WebAssembly/wasi-libc⁠#422](https://togithub.com/WebAssembly/wasi-libc/issues/422))
* [`7018e24d`](WebAssembly/wasi-libc@7018e24) Fix a use-after-free bug for detached threads ([WebAssembly/wasi-libc⁠#420](https://togithub.com/WebAssembly/wasi-libc/issues/420))
* [`43e71239`](WebAssembly/wasi-libc@43e7123) Improve `README.md` ([WebAssembly/wasi-libc⁠#425](https://togithub.com/WebAssembly/wasi-libc/issues/425))
* [`bd950eb1`](WebAssembly/wasi-libc@bd950eb) Use -fno-strict-aliasing for emmalloc ([WebAssembly/wasi-libc⁠#424](https://togithub.com/WebAssembly/wasi-libc/issues/424))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants