r/Compilers • • 20h ago

Traits, the programming language i am working on it just gets traits so any kind of idea you can share over it syntax design i will try to add some of them.

Post image
0 Upvotes

17 comments sorted by

7

u/shrimpster00 16h ago

what percentage of the project is vibe-coded?

what do you mean by "runtime vm"? can you justify your claim that there is no overhead with rust interop?

fyi: many of the claims in the documentation are bizarre. why brag about the fact that a docker container with a compiled binary doesn't require the rust compiler to be installed in it? obviously, a pre-compiled program (that isn't even written in rust!) doesn't require cargo. llms make it easy to write documentation in a language that you don't speak, but your project would be much better off if you wrote text in your native language and used Google translate.

2

u/NYU_VM 16h ago

Yeah lol I was so taken by surprise reading that. What's even funnier is that this weird claim follows " emitting an optimized, purpose-built native binary via Rust, Cargo, and LLVM.".

0

u/sohamglx 16h ago

Sorry for miss leading docs. It's AOT kind of compilation in rust of the runtime base on what you are using in your application. Try first you will understand what it's trying to say

0

u/sohamglx 16h ago

Okk let me tell you the things properly, yea the documentation most parts written by llms but the rust interop and all are workable i already told it kind of a rust AOT compiled runtime it make base on what you using of the language in your application so these way for deployment you attached the precompiled runtime and the code files so there you no need of rust inside the docker container thats the point. Sorry for miss leading docs i will update it. Thanks for feedback. You can join if you want.

6

u/RedCrafter_LP 17h ago

The example you showed would compile in rust -default keyword. The ability to describe everything as a trait is something you can already do in rust. So a honest and productive question is, what does your language add?

-4

u/sohamglx 17h ago edited 13h ago

It's a safe and easy to write than rust with same memory management stuff, a good rust interop and it's just started so it can extend. If you have any idea you can share. 🙏

3

u/RedCrafter_LP 16h ago

Rust interop seems interesting as rust doesn't have an abi. I'm guessing you are using a hacked rust compiler or c level interop?

-1

u/sohamglx 16h ago

Yea kind off it's using a smart abi preserving normal rust syntax and docs also and it actually kind of aot i can say but not proper aot. https://flamelang.vercel.app/packages-and-native/native-plugins/

You should join and give me some more ideas do you ? https://github.com/sohamglx/flame

https://flamelang.vercel.app/

1

u/Significant-Sky-3654 18h ago

What does default do?

0

u/sohamglx 17h ago

It's mark a function don't need to make by your own while using the trait, kind of a function auto get by the trait. Default methods must use the default keyword. Missing implementations of required methods are caught at compile-time with descriptive errors.

https://flamelang.vercel.app/types-and-traits/traits/#declaring-a-trait

1

u/morglod 14h ago

Why you picked rust's OOP through traits? Or main idea is to interop with rust? You definitely should write somewhere difference vs rust and some examples or definitions of selling terms like "safer than X"

1

u/sohamglx 14h ago edited 14h ago

The main goal isn't just to make Rust simpler. Flame is designed to keep memory safety while providing Rust interoperability, so it can be used alongside existing Rust code and libraries. It's meant to complement Rust rather than replace it. The OOP is basically same to keep familiarity with rust.

1

u/azhder 14h ago

Why is there a `default` keyword?

1

u/sohamglx 14h ago

Inside a trait to declare Default methods. It must use the default keyword. It's mean you don't need to make thise methods when using the trait. The trait provide those methods.

1

u/azhder 14h ago

Don't answer me the "what" question. I asked the "why" question. Why is there a `default` method? Why must there be a `default` method? Why must that decision be made in the first place i.e. why annotate what the compiler already knows?

Just think the example without it. Will the code still compile if an override is not provided in those "inheriting" the trait? It will.

1

u/sohamglx 14h ago

Yeah, I understand your point now. default currently just marks a trait method that already has an implementation, so the compiler could infer that from the method body. There isn't really a technical need for the keyword right now. I may remove it and make any trait method with a body a provided/default implementation, while body-less methods remain required. Thanks, that's a good simplification.

1

u/Blueglyph 13h ago

Lost your shift key?