Show HN: Muon, a low-level programming language inspired by C, C# and Go
I like it in general, but i have a few comments:<p>1. &quot;Data oriented. Just functions, structs and enums. NO: classes, inheritance, properties, etc.&quot;<p>I think you should allow for struct &quot;inheritance&quot;, at least in an Oberon-style manner. There are many cases where having a common &quot;head&quot; between structs is useful (e.g. widgets for a GUI toolkit, object types for a scripting language, etc).<p>2. &quot;Memory is initialized to zero. Array bounds are checked (can be turned off where needed).&quot;<p>It is not clear from this, but how can both be disabled in a case-by-case basis? For example in D local variables are initialized to zero by default but you can do something like (IIRC): Foo foo = ? (or = nil, i do not remember) which the compiler interprets as &quot;do not zero-initialize this). Similarly can i do something like array[foo] (bound checked) and array{foo} (non-bounds checked, imaginary syntax)?<p>3. &quot;An LLVM backend is in the works which will avoid any undefined behavior.&quot;<p>LLVM inherits most of C&#x27;s undefined behavior, so it will not solve your problem there - you&#x27;ll need to explicitly generate code that works around undefined behavior. This is a problem that the Free Pascal developers also faced (the language has much less undefined behavior than what LLVM assumes).<p>4. I am not fan of the language enforcing code style (e.g. &quot;The name of a type parameter must be a single uppercase character.&quot; and significant whitespace)<p>5. Nitpick, but &quot;List&lt;T&gt; struct #RefType { dataPtr pointer count int capacity int }&quot; is a dynamic array, not a list (also, an example of why significant whitespace isn&#x27;t a great idea :-P)<p>6. &quot;Type inference for function return values and locals&quot;<p>I actually prefer to explicitly see the data types passed around, it helps better understand what exactly the code is doing (not just the algorithms, but also the data types which are important) without needing to have too much &quot;implied code&quot; in my mind (i.e. with explicit data types i don&#x27;t need to &quot;know&quot; that &quot;foo&quot; returns &quot;bar&quot; when looking at its use in a diff (or any other non-syntax highlighted, non-code aware code viewing context), i actually know it because i see it in the code).<p>(FWIW for this reason i also dislike auto in C++ and similar constructs in other languages - you save a bit of short term typing now, for a lot of long term headache later)<p>7. &quot;fgets(s pointer #As(&quot;char <i>&quot;), size int, stream pointer #As(&quot;FILE </i>&quot;)) pointer #Foreign(&quot;fgets&quot;)&quot;<p>I think you need to make your type system good enough to natively express C types, otherwise the string-based pseudotypes will bite you hard later when you want to move away from using C as a backend.<p>8. I do not see any mention of a preprocessor, how is code supposed to IFDEF stuff (like, e.g. a commercial program that needs to have something like IFDEF DEMO, or a source file that needs to behave slightly differently if linked as a static library or dynamic library, or the use of two APIs like e.g. IFDEF LINUX, IFDEF WIN32, IFDEF OPENGL, IFDEF VULKAN, etc) or work around language limitations (like the non-availability of inherited structs mentioned above that C programs often work around by using a macro that defines common elements for structs)?<p>9. &quot;Number literal suffixes&quot;<p>I&#x27;m not fan of the underscore in the suffixes and also i&#x27;d avoid the uppercase L and introduce an i (that is &#x27;nop&#x27; but could be useful for automatically generated code via scripts and&#x2F;or macros).<p>There are other minor nitpicks, but i&#x27;d need to actually check it in practice to write more :-P.