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

連想配列の追加 #693

Closed
wants to merge 10 commits into from
Closed

Conversation

FineArchs
Copy link
Member

@FineArchs FineArchs commented Jun 5, 2024

概要

let sampledic = dic {
  [1]: null
  ['hoge']: 'fuga'
  [[1, 2, 4]]: [4, 5, 6]
  [Core:add]: @(){ print(1) }
}

let key = [1, 2, 4]
<: sampledic[key] // [4, 5, 6]

名前空間記法との兼ね合いから、キーは全て[ ]で囲うようになっています。
キーの等価性はdeep-equalになっています(関数のみ参照比較)。

実装

トライ木の構造を採用しています。
その都合上、キーを直列化する仕組みを導入しています。

Why

#225

備考

  • 循環参照対策はまだしていません
  • 同時書き込み対策はまだしていません
  • console.jsが書き換わっているのはついでです。変数が保持されるようになっています
  • 別PRで組み込みプロパティの追加もしたいです

@FineArchs FineArchs marked this pull request as ready for review June 21, 2024 11:48
Copy link
Contributor

@marihachi marihachi left a comment

Choose a reason for hiding this comment

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

キーを[]で囲むというのは方針として決まってるものですか?
先にissueの方で提案お願いします

@FineArchs
Copy link
Member Author

@marihachi

キーを[]で囲むというのは方針として決まってるものですか?

#225内のikasobaさんの案を部分的に採用したものになります。(文字列のキーのより簡潔な表記法については一旦後回しにしています)

方針として確定している訳ではないので、問題提起があれば再検討したいと思います。

@FineArchs FineArchs deleted the branch aiscript-dev:aiscript-next July 29, 2024 09:13
@FineArchs FineArchs closed this Jul 29, 2024
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