bpr
MModular
•Created by Hammad Ali on 11/10/2024 in #questions
Struct containing a list of itself?
I just compiled and ran your code on nightly and it worked. My Rust instincts are aligned with @toasty, and I thought you'd need to ensure you had a reference to the Node type.
5 replies
MModular
•Created by jmky on 10/7/2024 in #questions
Is there a disdain for Rust from the Mojo team?
Why is it that when we store the result of
return_immutable_ref
from main9
into a variable, we get a mutable deep copy of the original list?
23 replies
MModular
•Created by a2svior on 9/30/2024 in #questions
Runtime Reflection in Mojo?
TIL something new!
16 replies
MModular
•Created by a2svior on 9/30/2024 in #questions
Runtime Reflection in Mojo?
I'd find it helpful to see a whole bunch of examples of MLIR reflection with type system access before accepting a pronouncement about how they fare vs macros. Currently, I have no idea what it's supposed to be. Also, while I like Rust, I wouldn't put it's macro system up as the only macro system to compare with. There's also Nim, Scala, and Typed Racket, amongst others.
16 replies
MModular
•Created by banananas on 9/23/2024 in #questions
"Linking" structs together?
Show me what you mean. Please rewrite that code with your refined version of variant and your union type sugar.
I find Mojo's Variant unwieldy even compared to Nim's object variant and Ada's variant records. In those, you have a tag field to discriminate the cases rather than some generic type. If that's the refinement you have in mind, that and the addition of Python 3.10+ match-case construct would go a long way to making it look better in my eyes.
44 replies
MModular
•Created by banananas on 9/23/2024 in #questions
"Linking" structs together?
If Mojo had enums like Rust, that solution would be nicer.
44 replies
MModular
•Created by DobyDabaDu on 8/17/2024 in #questions
Mojo Build size
Right, I should have left the C out of the comparison as it was misleading. In any case, the stripped Mojo is close enough to the stripped Rust that I wouldn't sweat the size. I hope that future versions of "mojo build" will provide optimization flags that will allow us to make tradeoffs, but the biggest size one here is, as you said, dynamic vs static linking.
14 replies
MModular
•Created by DobyDabaDu on 8/17/2024 in #questions
Mojo Build size
Running
strip
on Ubuntu takes the size of the Mojo "hello world" executable from 4MB to 350K. For comparison, a C version is 16K and a Rust version built with the "--release" flag is 390K on my machine, and strips down to 327K.14 replies