Title: Brand new RowScript · Issue #195 · rowscript/rowscript · GitHub
Open Graph Title: Brand new RowScript · Issue #195 · rowscript/rowscript
X Title: Brand new RowScript · Issue #195 · rowscript/rowscript
Description: I feel an urge to rewrite RowScript. If you stumble upon this issue, it should crack you up: Yes, there's still a great amount of flaws in current design (up to version v1.0.0-alpha.5). But now I'm feeling like a guru on making languages...
Open Graph Description: I feel an urge to rewrite RowScript. If you stumble upon this issue, it should crack you up: Yes, there's still a great amount of flaws in current design (up to version v1.0.0-alpha.5). But now I'm...
X Description: I feel an urge to rewrite RowScript. If you stumble upon this issue, it should crack you up: Yes, there's still a great amount of flaws in current design (up to version v1.0.0-alpha.5). But now...
Opengraph URL: https://github.com/rowscript/rowscript/issues/195
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Brand new RowScript","articleBody":"I feel an urge to rewrite RowScript. If you stumble upon this issue, it should crack you up: Yes, there's still a great amount of flaws in current design (up to version `v1.0.0-alpha.5`). But now I'm feeling like a guru on making languages, let me refine it, please be patient.\n\n## Motivation: Scripting over Native\n\nSoftware industries are now only workable upon *dynamic/scripting languages*, e.g., JavaScript, Python, Lua, Ruby, Julia, Matlab... In terms of systems languages, like C/C++, Java, Rust, Go and Zig, they mostly serve as the engines or components of some bigger realms.\n\n1. **Dynamic/scripting languages are usually the first option for early problems.**\n\nFor domains like UI, graphics, AI, microservices, games and scientific computing, we keep seeing people use them for fast-prototyping and flexible developer experience.\n\nNonetheless, further problems like performance tuning and hardware adoption would convince people to use *systems languages*. But we should notice that it's hard and even unnecessary to replace the existing components written in dynamic/scripting languages. Every language serves their own scopes, but sometimes multi-language project management can be hard.\n\n(NB: Problems like writing language VMs, compilers and IDEs are not taken into account here, since designing such language is a different topic.)\n\n2. **Native support for dynamic/scripting languages should be a first-class citizen.**\n\nIt should not just be an AOT compiler for the program bytecodes. It should emit machine code directly. Run as an executable.\n\nTo sum up, RowScript emits JavaScript for scripting by default, and should be able to emit machine code for native support.\n\n## Native Support\n\nI would try [Cranelift] for backend and [MMTk] for making a GC. I have no further comments on this topic for now, it just requires a whole bunch of groundwork.\n\nYou should be asking about concurrent programming. Yes, it can be just using `libuv`, it can be stackless coroutines, it can be something else. I would talk about it some day.\n\n[Cranelift]: https://cranelift.dev/\n\n[MMTk]: https://www.mmtk.io/\n\n## Split the `number` Type\n\nFor native support, `number` type is far from usable anymore. We split it into:\n\n* Integers: `u8`, `u16`, `u32`, `u64`, `u128`, `i8`, `i16`, `i32`, `i64`, `i128`.\n* Floating-point numbers: `f16`, `f32`, `f64`.\n\n## Consistent Syntax over Reusing Keywords\n\nWhen I implemented the capabilities (#156) feature, I reused the `throws`, `try` and `catch` keywords for so-called *familiarity*, but apparently I failed to deliver the intention of the syntax. Users came up to me for complaints.\n\nThis time, forget about the \"familiarity\", we should use consistent and similar syntax.\n\n## Dependent Types\n\n1. **Impose dependent types in the surface syntax by default.**\n\nUnleash the full power of dependent types! Because scripting is so natural with it. We banned it in the current version for that \"people might not understand what they're doing\". But this time I feel confident about this feature.\n\n2. **`comptime` function.**\n\nFunction marked with `comptime` can be run everywhere in compile-time.\n\n3. **No internal dependent-type encodings.**\n\nI used so many encodings (e.g., Sigma types for function arguments) in the current codebase, it screwed up everything, from concrete syntax to even code generation. We should never use it again.\n\n## Arbitrary Control-flow Constructs\n\n1. **Feel free to use any control flow.**\n\nEveryone just can't live without it.\n\n2. **Use statements in AST.**\n\nIn the current design, I used CPS-style AST for convenience, this was proven to be disappointing (e.g. I banned control-flow constructs in closures, that's stupid).\n\n3. **`comptime` function could also have control-flow constructs.**\n\nSince we need native support, we have to translate the control-flow code into graph-based IRs for typechecking and code generation, so it's easy to write an abstract interpreter/partial evaluator to run any functions in compile-time.\n\n## Nominal over Structural Typing\n\n1. **`struct` type.**\n\nWe will still have our record-concatenation row polymorphism in the feature set, but it only comes up to solve subtyping problems for existing JavaScript constructs. `struct` is recommended in new application code.\n\nA similar situation can be found in Python where `@dataclass` and `TypedDict` are both supported but the former is more widely used.\n\n2. **Find the boundaries.**\n\nThe first problem that comes to my mind is whether `Option\u003cT>` should be nominal or structural. We need to find the boundaries, and even the balance. Let's make such decisions in the future.\n\n## And More...\n\n1. **`enum` type and flexible pattern matching.**\n\nPattern unification, I have to challenge this feature for the ultimate user experience.\n\n2. **Tuple type.**\n\nIt's proven to be highly useful, just don't miss this.\n\n## \"Isn't It Just Another [Dart]?\"\n\nRowScript **WILL NOT HAVE**:\n\n* Bytecode\n* JIT bytecode-to-machine compilation\n* AOT bytecode-to-machine compilation\n\nThat says:\n\n1. **No [isolates] are needed for *concurrency*.**\n - We might have something like this to solve other problems, for instance we could write many [Cgo]-based libraries and linked them into one single C executable to have many Go runtimes simultaneously. Some weird problems might arise, but we shouldn't isolate the runtime for concurrency if we only have one.\n3. **No subtyping-style [dynamic typechecking].**\n - We should have other approaches to object systems. But classic OOP/subtyping sounds quite overcomplicated for me.\n - We might also have inheritance, but it can be simple *has-a* inheritance for convenience. No complex subtyping cluttering.\n\nIt should just look like a compiled and managed language. No more magic inside.\n\n[Dart]: https://dart.dev/\n\n[isolates]: https://dart.dev/language/concurrency\n\n[Cgo]: https://pkg.go.dev/cmd/cgo\n\n[dynamic typechecking]: https://dart.dev/overview#runtime\n\n## New Slogan\n\n**A better JavaScript that types and compiles.**","author":{"url":"https://github.com/anqur","@type":"Person","name":"anqur"},"datePublished":"2025-05-10T06:15:05Z","url":"https://github.com/rowscript/rowscript/issues/195"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:486f9f1f-e0d3-fc18-9708-400c1b5913a0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 899A:2FFF08:40F14BF:558D76D:6AFA3B2D |
| html-safe-nonce | 0ff2312fa28f44e084673bc8679530904c32328efccb50d2cebee2fbb2674be4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTlBOjJGRkYwODo0MEYxNEJGOjU1OEQ3NkQ6NkFGQTNCMkQiLCJ2aXNpdG9yX2lkIjoiNDM3NDUwNzg2MzAyODY3NzQyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e13f3a0ca382d9a5dff0811f8d10c37f2f43ac89d7cceaec6cdc38e5752ab30b |
| hovercard-subject-tag | issue:3053759683 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/rowscript/rowscript/195/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3b264c3cf3142d3aa8998452d21183f2150dd8072857b5955b44d84993f5ca1b/rowscript/rowscript/issues/195 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3b264c3cf3142d3aa8998452d21183f2150dd8072857b5955b44d84993f5ca1b/rowscript/rowscript/issues/195 |
| og:image:alt | I feel an urge to rewrite RowScript. If you stumble upon this issue, it should crack you up: Yes, there's still a great amount of flaws in current design (up to version v1.0.0-alpha.5). But now I'm... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | anqur |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-preview |
| go-import | github.com/rowscript/rowscript git https://github.com/rowscript/rowscript.git |
| octolytics-dimension-user_id | 87884599 |
| octolytics-dimension-user_login | rowscript |
| octolytics-dimension-repository_id | 388972006 |
| octolytics-dimension-repository_nwo | rowscript/rowscript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 388972006 |
| octolytics-dimension-repository_network_root_nwo | rowscript/rowscript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width