Arvin_David
Arvin_David
MModular
Created by Arvin_David on 4/16/2024 in #questions
Future of Literals. Are they going to be removed?
Thanks guys. These explanations are exactly what I wanted to hear.
11 replies
MModular
Created by Arvin_David on 4/16/2024 in #questions
Future of Literals. Are they going to be removed?
For instance, maybe literals get identified and handled only by the compiler itself and not be definable explicitly by the user anymore? Something like what Python does? So then only one 'string' struct is what is needed to get written/used in all codes?
11 replies
MModular
Created by Arvin_David on 4/16/2024 in #questions
Future of Literals. Are they going to be removed?
I understand but at the moment, we have some string methods that we don't have in string literal. My question is whether string literal should eventually replicate all methods implemented for string or it will be removed in the future without any need for extra copy-pasting to make them compatible. Also as another example, when the builtin type function got implemented in Mojo, should we get the result of 'type("Hello World!")' as string literal or string? From the Pythonic aspect and without knowing what's going on under the hood, we simply identify that as a "string" in Python so it's questionable how is this going to be like in Mojo. I hope these explanations can clarify why I asked this question. 😄
11 replies
MModular
Created by Arvin_David on 4/6/2024 in #questions
Optional function argument?
I found the solution. It's a little bit tricky but cool to know:
from collections.optional import Optional

def main():
test(3) # does not print anything
test(3, 0) # prints 0
test(3, 5) # prints 5

fn test(item0: Int, item1: Optional[Int] = None):
if item1:
print(item1.value())
from collections.optional import Optional

def main():
test(3) # does not print anything
test(3, 0) # prints 0
test(3, 5) # prints 5

fn test(item0: Int, item1: Optional[Int] = None):
if item1:
print(item1.value())
6 replies
MModular
Created by Arvin_David on 4/6/2024 in #questions
Optional function argument?
Thanks a lot. But how can I also check if it's none or not?
from collections.optional import Optional

def main():
test(3)

fn test(item0: Int, item1: Optional[Int] = None):
print(item1.value())
from collections.optional import Optional

def main():
test(3)

fn test(item0: Int, item1: Optional[Int] = None):
print(item1.value())
For example in the code above, I wonder why the printed value is 0. As far as I know, we cannot print None at the moment, So is mojo converting None to 0, or None was initially treated like zero? How can I check if it's originally None or not?
6 replies
MModular
Created by Khaled M' on 4/1/2024 in #questions
Does anyone think Mojo could be great for Game Development?
Integrating Mojo into game development, especially with engines like Unreal Engine that use C++, could be groundbreaking. Drawing inspiration from 'unreal-rust', a Mojo plugin for Unreal could leverage Mojo's performance edge over Python and C++ in certain areas. This would not only enhance development efficiency but also open up new possibilities for game developers looking to create complicated games with the least effort possible (on the programming side). I'm genuinely excited about the prospects and eagerly look forward to it. P.S. If I’m not wrong, Modular is cooperating with many big companies to leverage Mojo's popularity and capabilities. Just as an idea, as far as the roadmap focuses constantly on leveraging the performance with hardware accelerators, starting a new cooperation with EpicGames (the Company behind Unreal Engine) is somehow not changing the roadmap and can lead to moreover popularity.
84 replies
MModular
Created by Arvin_David on 3/28/2024 in #questions
How to Create a Multi-Type List in Mojo?
I completely understand but things differ when people track mojo because of the revolutionary movements they state they can build. So then being Python's superset promise is a fake marketing statement when we are not going to have the available dynamism in Python right? I remember in one of the streams that Modular had, they said that they really look forward to running Python packages natively in Mojo but they are far from there at that moment. So this sight is not more than a dream when simple or complicated packages rely on this dynamism like pandas. When we can't parse them, we can't run them in now or the future, right? It personally seems like a huge conflict between desires, modular dreams, their statements, and the reality we are facing as you also explained. I could say these to Rust core developers but it certainly matters what we expect from who. That's where the brand, the team, and their previous statements become considerable. Nevertheless, I appreciate any revolutionary movement forward for narrowing down the gap between dreams and realities.
25 replies
MModular
Created by Arvin_David on 3/28/2024 in #questions
How to Create a Multi-Type List in Mojo?
OMG, That's terrible! I don't know what the get method does and also cannot understand why in a single type list, just a dereferencing works, but here, we need such a tweak. Do you think it's going to be fixed? Because I deeply believe that Mojo's collections are not well documented with examples or explanations and very very hard to work with. Modular wants developers to bring their ideas into Mojo but it's using Python's syntax while not keeping its beauty even after being open-sourced. I understand it's going to take a while but powerful easy-to-use datatypes are on top of priorities even before the Windows version release. Because I think we need a community-acceptable language before making it public for use. I mean it's still truly usable but not user-friendly at all in many cases… However curious to know more about its future. I appreciate knowing others' ideas. P.S. Modular wants to bring a lovely language with a full dynamism basis (Python) to the language compilers world. That's wonderful and time-consuming, but are we even slowly getting there? I believe current clues about not resolved limitations show something else.
25 replies
MModular
Created by Arvin_David on 3/28/2024 in #questions
How to Create a Multi-Type List in Mojo?
Yes, I'm aware of dereferencing but it does not seem to work if the defined List has a variant type as the latest code Sora shared.
25 replies
MModular
Created by Arvin_David on 3/28/2024 in #questions
How to Create a Multi-Type List in Mojo?
Thanks but it seems it's not printable. I tried to print l, even doing a for loop on it and printing the for variable but none of them worked. Somewhere in the output errors, compiler says: failed to infer parameter 'T', argument type 'Reference[Variant[SIMD[ui8, 1], SIMD[f64, 1], StringLiteral], 1, l]' does not conform to trait 'Stringable'
25 replies