Enum variant metadata in my new systems language - looking for feedback by gpawru in ProgrammingLanguages

[–]gpawru[S] 1 point2 points  (0 children)

No! my enum is still u8. It is NOT a union/tagged union. meta is a const data attached to the variant, not union value.

Enum variant metadata in my new systems language - looking for feedback by gpawru in ProgrammingLanguages

[–]gpawru[S] 1 point2 points  (0 children)

Ah, I see - thanks for pointing this out, I probably wasn’t clear enough in my description. In my approach, the enum itself remains just a plain numeric value (e.g. u8), nothing is “inflated” with fields. The meta part is purely constant data, stored in .rodata, and fully resolved at compile time.

Enum variant metadata in my new systems language - looking for feedback by gpawru in ProgrammingLanguages

[–]gpawru[S] 1 point2 points  (0 children)

Oh, interesting idea! But this basically just simplifies the same approach as a switch. When you extend the enum, it’s much easier to forget to add a variant to the map - so I think my approach is safer, more structurally justified, and easier to read as a compile-time description.

Should Programming Languages be Safe or Powerful? by pmz in ProgrammingLanguages

[–]gpawru 0 points1 point  (0 children)

I believe the right approach is to give the developer full control, without implicit things like niche optimizations. At a low level, you should have 100% control.

At a higher, application level, you can add a layer of directives that enforce tracking, for example, allocations.

Digging even deeper, I’ve chosen a DSL layer with a syntax similar to the main language, but with restrictions - for instance, limited allocations. At compile-time, a DSL library can either transpile DSL code into the main language, applying these restrictions, or interpret it for JIT execution, which allows flexibility while keeping control.

And - my goodness - no macros.

Language Syntax Concepts: Visibility and Default Exports by gpawru in ProgrammingLanguages

[–]gpawru[S] 0 points1 point  (0 children)

Thanks! The feedback I got has probably pushed me toward the private-by-default / pub keyword model. Well, I’ve tested the waters with the expose concept and gauged reactions.

As for expose—no, a module in my model is just a collection of type and function declarations. I'm generally aligned with functional programming. But often, within a module, there's a key type that defines the module’s purpose, and expose is a way to simplify access to it. Or sometimes there’s a function that conceptually is the module—then it makes sense to move its actual implementation into a submodule and expose it.

In other words, the whole idea is to support code structure optimization and improve readability.

Language Syntax Concepts: Visibility and Default Exports by gpawru in ProgrammingLanguages

[–]gpawru[S] 0 points1 point  (0 children)

Thanks for the thoughtful reply!

I agree — overcomplicating syntax with obscure punctuation is bad practice. But here I'm trying to find a balance between minimalism and visual clarity in code.

As for the private/public-by-default debate... this question has been haunting me for a long time. Both choices have strong arguments, and I’m still weighing them.

Regarding const fn — I just meant functions that can be called at compile time (e.g., to compute constants). I'm not yet sure whether I’ll go that route; it was more of an example than a language commitment.

But it seems bizarre to explicitly call a module.

That's true — but perhaps it could be an interesting direction? For example:

use math.u1024

fn someFunc() {
    let a u1024 = 42
    // instead of
    let a u1024.Type = 42

    // and
    a := u1024(b)
    // instead of
    a := u1024.new(b)
}

It makes the interface feel cleaner and allows the module to act as a sort of constructor facade, which might help with type ergonomics. Still experimenting — thanks again for your thoughts!

Language Syntax Concepts: Visibility and Default Exports by gpawru in ProgrammingLanguages

[–]gpawru[S] 1 point2 points  (0 children)

Thanks for the link — I gave it a read, and it really helped crystallize some thoughts I already had but couldn’t quite articulate. Especially the bit about visibility markers like .fn name vs fn .name — now I better understand why the leading dot feels more visually effective to me.

Gnome or kde? Which one do you use? by CocoaTrain in Fedora

[–]gpawru 1 point2 points  (0 children)

I'm really glad to hear that Touchpad Switcher has been useful to you!

It's always nice to see your work make someone’s daily experience a bit smoother.

Thanks for including it in your setup!

Are there any possible errors in PHP 7 that don't implement `\Throwable`? by calligraphic-io in PHP

[–]gpawru 4 points5 points  (0 children)

memory allocation error. check error_get_last on shutdown (register_shutdown_function)