Idea detail
adv_01_imports_ideasets
reqlan rq/marketing_and_media/tutorials.rq:1725
block
Summary
Audience: builders with a single-file graph who feel reference sprawl or duplicate idea names across files.
Outcome: split ideas across files; use `from` / `import` and namespace import; group with ideasets; resolve qualified references without breaking call-site readability.
Runtime: 9 – 10 min.
Demo: advanced baseline open on `reqs/product.rq`; `reqs/auth.rq` exists with `login_api` and `session_policy` but `product.rq` still references them without imports — caret on a broken or unresolved link.
Related: import_from import_namespace ideaset file reference
Attributes
| Key | Value |
|---|---|
| example | ```rq // reqs/auth.rq auth_core ( login_api, session_policy ) login_api { POST /login validates credentials and starts a session. Bound by session_policy. Implementation: login.ts } session_policy { Sessions expire after thirty minutes of inactivity. } password_rules { Passwords must be at least twelve characters and reject empty submissions. } // reqs/product.rq — before fix: bare login_api fails or resolves ambiguously from "./auth.rq" import login_api import "./auth.rq" as auth welcome_flow { Success continues to login_api. Session rules live under session_policy. Password policy: see password_rules. } ``` |
| script | SCR: Cold open on `product.rq`. Hover an unresolved `login_api` — Problems panel or squiggle if visible. Explorer shows both `product.rq` and `auth.rq`. VO: One file is a great start. Real projects become a web of files — and links that worked by accident in a single document need imports to stay honest. SCR: Open `auth.rq`. Show `login_api`, `session_policy`, and the `auth_core` ideaset paren list. VO: Each file is its own ideaspace. Moving auth ideas here does not change what an idea is — it changes where the handle lives. SCR: Return to `product.rq`. Type `from "./auth.rq" import login_api`. Save. Link resolves. Go-to-definition lands in `auth.rq`. VO: From-import pulls one idea into scope. Use it when the call site names that neighbour often and nothing else from the file. SCR: Add `import "./auth.rq" as auth`. Replace session reference with `session_policy`. Brief pause on readability. VO: Namespace import gives you a prefix for the whole file. Judgement call: if you reference three ideas from auth, namespace usually reads cleaner than three from-import lines. SCR: Highlight `auth_core` ideaset in `auth.rq`. Optional: Ideas Summary ideas table filtered to `auth.rq` path. VO: Ideasets group names without inventing a heavier module system. They document membership — useful in reviews — but imports still control what this file can link to. SCR: Misconception beat — split screen: over-imported file with six from-imports vs one namespace line. Narrator picks namespace. VO: Common mistake: import everything "just in case". Import the smallest surface that keeps references readable. SCR: Move `password_rules` live from `product.rq` into `auth.rq` if still in product. Fix product with `password_rules`. VO: Try this: move `password_rules` into `auth.rq` and fix `product.rq` with the smallest import that works. If you maintain multiple bases later, imports do not cross base boundaries — same rule as get-started. SCR: End card → "Attributes without bloat". |
| slides | { id title transition fade background brand-dark kicker Advanced · 01 heading Imports and ideasets body One file is a start. Real graphs span files — imports keep links honest. asset logo notes One file is a great start. Real projects become a web of files. }, { id split transition fade background brand-panel heading Split before sprawl body Auth ideas in auth.rq. Product ideas stay in product.rq. code_lang rq code login_api { Bound by session_policy. } notes Each file is its own ideaspace. Moving ideas changes where the handle lives. }, { id from-import transition none background brand-panel heading From-import one idea body Pull a single neighbour when that is all the call site needs. code_lang rq code from "./auth.rq" import login_api notes From-import pulls one idea into scope. }, { id namespace transition fade background brand-panel heading Namespace the file body Alias the whole module when several ideas travel together. code_lang rq code import "./auth.rq" as auth · session_policy notes If you reference three ideas from auth, namespace usually reads cleaner. }, { id ideaset transition fade background brand-panel heading Ideasets as namespaces body Group related ideas without a heavier module system. code_lang rq code auth_core ( login_api, session_policy ) notes Ideasets document membership. Imports still control what this file can link to. }, { id judgement transition none background brand-contrast heading Import the smallest surface body Six from-imports vs one namespace — pick readability, not completeness. code_lang rq code from "./auth.rq" import a, b, c, d… vs import "./auth.rq" as auth notes Common mistake: import everything just in case. }, { id base-boundary transition fade background brand-panel heading Imports respect base boundaries body Cross-file links stay inside the active base graph. code_lang txt code demo/.reqlan/ · auth.rq + product.rq same base notes Imports do not cross nested base boundaries — same discipline as get-started. }, { id try-this transition fade background brand-dark heading Try this body Move password_rules into auth.rq. Fix product.rq with the smallest import that works. fragments Next — Attributes without bloat notes Pick the import shape that keeps call sites readable. } |
Ancestor context
No ancestor chain recorded.
| Kind | Idea | Path | Snippet |
|---|---|---|---|
| None | |||
| Kind | Idea | Path | Snippet |
|---|---|---|---|
| ideaset_member | advanced_series | reqlan rq/marketing_and_media/tutorials.rq | — |
| ideaset_member | slide_decks | reqlan rq/marketing_and_media/tutorials.rq | — |
| Kind | Idea | Path | Snippet |
|---|---|---|---|
| references | file | file | |
| references | ideaset | ideaset | |
| references | import_from | import_from | |
| references | import_namespace | import_namespace | |
| references | reference | reference | |
| references | session_policy | session_policy |
Initialising graph…