Skip to content

RFC: Language and IDE ideas #126

@Irev-Dev

Description

@Irev-Dev

From the inception of this language, when I initially presented a basic demo, a significant portion of the demo was dedicated to justifying our decision to develop our own domain-specific language (DSL). While I won't delve into those details at this moment, the extended explanation was because language development shouldn't be taken lightly. But since we're commit to this endeavor, the language should fulfill the following objectives:

  1. Kick butt
  2. Establish distinct boundaries to aid us in trimming its scope
  3. Cater well to our users, that is folks who might not have programmed before

Here are some ideas for your consideration.

  1. App will have a default directory, When users create a new project it will add a new folder to this directory with its name and create the structure of the project (project.toml with name = <name>, some folders including a components folder and components/main.pf)
  2. A project will just be a directory, but the project.toml will be what defines a project.
  3. The app will search the default directory for all project.tomls and grab the project's name and display a list of those projects in the app's home screen for the user to select from
  4. Of course users can still open a file browser to select a project/repo that's not in their default directory.
  5. project.toml will function much the same as a package.json or cargo.toml, listing dependencies, and any other metadata about the project.
  6. Lang will change from having the show function to exports/public entities. I think this is a better pattern for defining what 3d artifacts are displayed in the scene, and separately supports building utils/modules in separate files.
  7. In general, we'll aim for, convention over configuration. Want to make all projects feel familiar as will help foster an ecosystem.
  8. The lang will support special comments for documentation, both of Rusts ///for documenting specific things and//!` should be borrowed.
  9. We can also borrow Go's convention of function names prefixed with example to become examples for the suffix (exampleSomeFn is an example for someFn)
  10. It would be good for our documentation to have syntax for putting screenshots into the docs (possibly with annotations) This is a departure from other languages' docs system, but reflects the visual nature of the lang image
  11. Reserved folder names, so far I can think of three, examples, components and lib
  • examples: (self-explanatory, become examples in the docs)
  • components: each file in the folder is expected to export 3d entities (not functions, data or other). When a user selects one of these files they will execute and display in the 3d-scene. components is probably not the best name, the name needs to be fairly generic as needs to cover piece-parts and assemblies. any suggestions?. options: Elements, Structures, Units, Constructs, Modules
  • lib: just a place for general utils and abstractions that might be used by multiple components. When a user selects one of these, the editor won't change.
  1. project.toml will be treated as the central file that defines the project. When the user selects it the right-hand pane (usually the 3d-scene) will instead render the documentation for the project.
  2. parts/main.pf will be a special name that we'd expect to normally be the assembly for an entire project. //! comments at the start of this file form the start of the documentation when the user selects the project.toml. image
  3. In the short term project.toml can list dependencies as file paths, URLs and git-urls. While a centralised package repository would be nice at some point, allowing the above gives a lot of bang for buck when it comes to having some dependencies support and suits our "local first" approach.
  4. Opinionated formatting: this is already the case since it had to be built for the recasting ability. At some point, we might want to allow some preferences here, but for now, keeping it strict is less of a maintenance burden.
  5. Dev tools: Big big topic especially since the code-gen that makes up the core of this app is arguably a dev tool. I'll link to Bret Victor's Learnable Programming that @franknoirot found as there's lots there to learn from.
  6. Walk through onboarding, Getting set up with our mouse preferences etc, as well as walking through how to make their first part.

Needs more consideration

  • Errors, how we expose them to user's and how we can best help users resolve them.

Further in the future

  • built-in testing framework
  • types
  • Plugin system, for example, I don't particularly want to build git support, but maybe someone else can.

not doing

  • no async, or concurrency support
  • no running processes. i.e. no puffin servers.
  • I don't think either of the above belongs as capability in the lang, we should stay focused on the use case of script executes to output an artifact.
  • No HTTP, I can see us budging on this, but to begin within at least we shouldn't support it. If data needs to be fetched, it should be done beforehand by some other lang/process and left in a csv/json or something to be imported by our lang.
  • Exploding scope by supporting other langugaes: Many of the limitations we decide to put on the language will have an easy workaround if executing scripts from other langs is supported.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions