Unify bare-identifier semantics in *…* / **…** (Python namespace)
Inside italic/bold code segments every bare word is a variable — including call arguments and method-call receivers — so text literals must be quoted and receivers no longer need backticks. A bare dotted callee `a.b` resolves as a method call when `a` is a local variable, otherwise as a library path (Python-style unified namespace), in both the tree-walk and bytecode backends. Migrate ~70 tests plus ext/web, ext/quantum, ext/ai and the example projects to the new idiom; update SKILL.md and the design docs; fix the web/quantum example data model (db/index.mq.md). Unit and gold suites pass; only the 3 network-live tests fail offline. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
f275d1e030
commit
bd5555afaa
86 files changed
+1539
-1467
No files matched your search
@@ -19,9 +19,9 @@ H on qubit 0, then CNOT(0→1). Ideal measurement: |00⟩ and |11⟩ each with p
|
||||
| 1 | H | 0 |
|
||||
| 2 | CX | 0,1 |
|
||||
|
||||
*`qc` = > quantum.circuit qubits=2 steps=`steps` *
|
||||
*`p` = > `qc`.probabilities *
|
||||
*`_` = > `qc`.draw path=bell.svg *
|
||||
*`_` = > `qc`.draw kind=probs path=bell-probs.svg *
|
||||
*qc = > quantum.circuit qubits=2 steps=`steps`*
|
||||
*p = > qc.probabilities*
|
||||
*_ = > qc.draw path="bell.svg"*
|
||||
*_ = > qc.draw kind="probs" path="bell-probs.svg"*
|
||||
|
||||
> print text=`p`
|
||||
@@ -18,11 +18,11 @@ H on qubit 0, CX(0→1), CX(0→2). Ideal: |000⟩ and |111⟩ each with probabi
|
||||
| 2 | CX | 0,1 |
|
||||
| 3 | CX | 0,2 |
|
||||
|
||||
*`qc` = > quantum.circuit qubits=3 steps=`steps` *
|
||||
*`p` = > `qc`.probabilities *
|
||||
*`_` = > `qc`.draw path=ghz.svg *
|
||||
*`_` = > `qc`.draw kind=probs path=ghz-probs.svg *
|
||||
*`H` = > quantum.gate name=H *
|
||||
*`_` = > `H`.draw kind=matrix path=ghz-h-matrix.svg *
|
||||
*qc = > quantum.circuit qubits=3 steps=`steps`*
|
||||
*p = > qc.probabilities*
|
||||
*_ = > qc.draw path="ghz.svg"*
|
||||
*_ = > qc.draw kind="probs" path="ghz-probs.svg"*
|
||||
*H = > quantum.gate name="H"*
|
||||
*_ = > H.draw kind="matrix" path="ghz-h-matrix.svg"*
|
||||
|
||||
> print text=`p`
|
||||
@@ -7,13 +7,13 @@ import articles:articles.mq.md
|
||||
|
||||
## open
|
||||
|
||||
*`store` = > 网页.数据库 地址="sqlite:data/site-zh.db" *
|
||||
*`fields` = > articles.schema *
|
||||
*store = > 网页.数据库 地址="sqlite:data/site-zh.db"*
|
||||
*fields = > articles.schema*
|
||||
> `store`.初始化 名=articles 字段=`fields`
|
||||
*`rows` = > `store`.查询 表=articles 上限=1 *
|
||||
*rows = > store.查询 表="articles" 上限=1*
|
||||
1. `rows`
|
||||
**`store`**
|
||||
**store**
|
||||
2. *
|
||||
*`seed` = > articles.seed *
|
||||
*seed = > articles.seed*
|
||||
> `store`.插入 表=articles 行=`seed`
|
||||
**`store`**
|
||||
**store**
|
||||
@@ -24,8 +24,8 @@ import db:db/index.mq.md
|
||||
|
||||
| 属性 | 值 | 样式 |
|
||||
|------|-----|------|
|
||||
| `title` | articles.`articles`.title | shell.`card_title` |
|
||||
| `body` | articles.`articles`.body | shell.`card_body` |
|
||||
| title | articles.`articles`.title | shell.`card_title` |
|
||||
| body | articles.`articles`.body | shell.`card_body` |
|
||||
|
||||
`article_fields` =
|
||||
|
||||
@@ -42,24 +42,24 @@ import db:db/index.mq.md
|
||||
| title | max:120 | 标题太长 |
|
||||
| body | max:8000 | 正文太长 |
|
||||
|
||||
*`store` = > db.open *
|
||||
*`page` = > 网页.页面 标题="Marqdo 中文站" 引言="<h1>中文站</h1><p>表格 + 类方法。</p>" *
|
||||
*`page` = > `page`.组件装配 组件=`home` *
|
||||
*`page` = > `page`.主体装配 主体=`index` *
|
||||
*store = > db.open*
|
||||
*page = > 网页.页面 标题="Marqdo 中文站" 引言="<h1>中文站</h1><p>表格 + 类方法。</p>"*
|
||||
*page = > page.组件装配 组件=home*
|
||||
*page = > page.主体装配 主体=index*
|
||||
|
||||
*`about` = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>导入网页.mq.md 即用中文 API。</p>" *
|
||||
*`about` = > `about`.组件装配 组件=`home` *
|
||||
*about = > 网页.页面 标题="关于" 引言="<h1>关于</h1><p>导入网页.mq.md 即用中文 API。</p>"*
|
||||
*about = > about.组件装配 组件=home*
|
||||
|
||||
*`article_form` = > 网页.表单 表=articles 动作=插入 *
|
||||
*`article_form` = > `article_form`.字段 字段=`article_fields` *
|
||||
*`article_form` = > `article_form`.规则 规则=`article_rules` *
|
||||
*article_form = > 网页.表单 表="articles" 动作="插入"*
|
||||
*article_form = > article_form.字段 字段=article_fields*
|
||||
*article_form = > article_form.规则 规则=article_rules*
|
||||
|
||||
*`new` = > 网页.页面 标题="写文章" 引言="<h1>写文章</h1><p>表单嵌在主区。</p>" *
|
||||
*`new` = > `new`.组件装配 组件=`home` *
|
||||
*`new` = > `new`.表单装配 id=article 表单=`article_form` *
|
||||
*new = > 网页.页面 标题="写文章" 引言="<h1>写文章</h1><p>表单嵌在主区。</p>"*
|
||||
*new = > new.组件装配 组件=home*
|
||||
*new = > new.表单装配 id="article" 表单=article_form*
|
||||
|
||||
*`app` = > 网页.应用 页面=`page` 数据库=`store` 后台=True 主机=127.0.0.1 端口=18082 *
|
||||
*`app` = > `app`.路由 路径=/about 页面=`about` *
|
||||
*`app` = > `app`.路由 路径=/new 页面=`new` *
|
||||
*`app` = > `app`.静态 目录=public 挂载=/static *
|
||||
*app = > 网页.应用 页面=page 数据库=store 后台=True 主机="127.0.0.1" 端口=18082*
|
||||
*app = > app.路由 路径="/about" 页面=about*
|
||||
*app = > app.路由 路径="/new" 页面=new*
|
||||
*app = > app.静态 目录="public" 挂载="/static"*
|
||||
> `app`.监听
|
||||
@@ -8,13 +8,13 @@ import fs:lib/fs.mq.md
|
||||
|
||||
## open
|
||||
|
||||
*`store` = > web.db url="sqlite:data/site.db" *
|
||||
*`fields` = > articles.schema *
|
||||
*store = > web.db url="sqlite:data/site.db"*
|
||||
*fields = > articles.schema*
|
||||
> `store`.init name=articles fields=`fields`
|
||||
*`rows` = > `store`.select table=articles limit=1 *
|
||||
*rows = > store.select table="articles" limit=1*
|
||||
1. `rows`
|
||||
**`store`**
|
||||
**store**
|
||||
2. *
|
||||
*`seed` = > articles.seed *
|
||||
*seed = > articles.seed*
|
||||
> `store`.insert table=articles rows=`seed`
|
||||
**`store`**
|
||||
**store**
|
||||
@@ -26,8 +26,8 @@ Main content is not a reusable component, so it is authored here.
|
||||
|
||||
| 属性 | 值 | 样式 |
|
||||
|------|-----|------|
|
||||
| `title` | articles.`articles`.title | shell.`card_title` |
|
||||
| `body` | articles.`articles`.body | shell.`card_body` |
|
||||
| title | articles.`articles`.title | shell.`card_title` |
|
||||
| body | articles.`articles`.body | shell.`card_body` |
|
||||
|
||||
Article create form (design §5.5): field table + rules table.
|
||||
|
||||
@@ -46,28 +46,28 @@ Article create form (design §5.5): field table + rules table.
|
||||
| title | max:120 | Title is too long |
|
||||
| body | max:8000 | Body is too long |
|
||||
|
||||
*`store` = > db.open *
|
||||
*`page` = > web.page title="Marqdo Web Site" intro="<h1>Web Site</h1><p>Tables + class methods.</p>" *
|
||||
*`page` = > `page`.compose_components components=`home` *
|
||||
*`page` = > `page`.compose_main main=`index` *
|
||||
*store = > db.open*
|
||||
*page = > web.page title="Marqdo Web Site" intro="<h1>Web Site</h1><p>Tables + class methods.</p>"*
|
||||
*page = > page.compose_components components=home*
|
||||
*page = > page.compose_main main=index*
|
||||
|
||||
About page: same shell, different intro (no main bind).
|
||||
|
||||
*`about` = > web.page title="About" intro="<h1>About</h1><p>Marqdo web = tables + class methods.</p>" *
|
||||
*`about` = > `about`.compose_components components=`home` *
|
||||
*about = > web.page title="About" intro="<h1>About</h1><p>Marqdo web = tables + class methods.</p>"*
|
||||
*about = > about.compose_components components=home*
|
||||
|
||||
*`article_form` = > web.form table=articles action=insert *
|
||||
*`article_form` = > `article_form`.fields fields=`article_fields` *
|
||||
*`article_form` = > `article_form`.rules rules=`article_rules` *
|
||||
*article_form = > web.form table="articles" action="insert"*
|
||||
*article_form = > article_form.fields fields=article_fields*
|
||||
*article_form = > article_form.rules rules=article_rules*
|
||||
|
||||
New article: form embedded in the page main slot (design §5.5.4).
|
||||
|
||||
*`new` = > web.page title="New article" intro="<h1>New article</h1><p>Form lives in the main slot.</p>" *
|
||||
*`new` = > `new`.compose_components components=`home` *
|
||||
*`new` = > `new`.compose_form id=article form=`article_form` *
|
||||
*new = > web.page title="New article" intro="<h1>New article</h1><p>Form lives in the main slot.</p>"*
|
||||
*new = > new.compose_components components=home*
|
||||
*new = > new.compose_form id="article" form=article_form*
|
||||
|
||||
*`app` = > web.app page=`page` db=`store` admin=True host=127.0.0.1 port=18081 *
|
||||
*`app` = > `app`.route path=/about page=`about` *
|
||||
*`app` = > `app`.route path=/new page=`new` *
|
||||
*`app` = > `app`.static dir=public mount=/static *
|
||||
*app = > web.app page=page db=store admin=True host="127.0.0.1" port=18081*
|
||||
*app = > app.route path="/about" page=about*
|
||||
*app = > app.route path="/new" page=new*
|
||||
*app = > app.static dir="public" mount="/static"*
|
||||
> `app`.listen
|
||||
Reference in new issue
Block a user