rdickert
rdickert
Explore posts from servers
MModular
Created by jameswatson.eth on 10/26/2023 in #questions
is it wise to start with Modular as your first language?
IMO If Mojo appeals to you, the best way to start may be to work on Python. You'll need all of those skills in Mojo, and python has lots more resources (and full classes/books/etc) on the web. Also, Python is an excellent first language (Mojo will be too, once it's more complete) The problem with starting with Mojo at this time is that the language is incomplete, and you aren't in a good place to work around missing features and sharp edges. Also, strong typing is great but will add difficulty. As an experienced developer (from js world), I'm starting with Python but then bringing my Python code to Mojo to try the new features to see if I understand the types and can make things faster. I think a new coder can do the same thing.
I've been happy with exercism as a learning platform for almost any language. I've used it for Rust and Python, and it's beginner-friendly and free.
8 replies
MModular
Created by b4rdarian on 10/24/2023 in #questions
Confusion with owned integers
@b4rdarian great research. I think this must be on the right track. This is probably worth filing an issue on the repo
32 replies
MModular
Created by Yeison Rodriguez on 10/20/2023 in #questions
Does owned make the variable copy on write?
@Yeison Rodriguez The docs seem to say so. Possibly related to your question: https://discord.com/channels/1087530497313357884/1166282705873416222
3 replies
MModular
Created by olmirr on 10/20/2023 in #questions
error: Unable to locate a suitable libpython when running Mojo executable
on macos, libpython ends with .dylib. So you can do something like this (here's a real example using miniconda in an env called mojo1 ):
export MOJO_PYTHON_LIBRARY=/Users/me/miniconda3/envs/mojo1/lib/libpython3.11.dylib
export MOJO_PYTHON_LIBRARY=/Users/me/miniconda3/envs/mojo1/lib/libpython3.11.dylib
2 replies
MModular
Created by b4rdarian on 10/24/2023 in #questions
Confusion with owned integers
@b4rdarian I tried the above code but changed let x to var x:
def check_int():
var x = 10
let y = take_ownership_int(x)
print("x = " + String(x))
print("y = " + String(y))

check_int()
def check_int():
var x = 10
let y = take_ownership_int(x)
print("x = " + String(x))
print("y = " + String(y))

check_int()
This works and prints x=10 and y=15, but there is a compiler warning: 'x' was declared as a 'var' but never mutated, consider switching to a 'let' So making x mutable unblocks the code and clearly copies x as expected, but the compiler tells us to switch to let, which gives a compiler error. The docs note: "Currently, Mojo always makes a copy when a function returns a value." So I'm not quite sure where this leaves us.
32 replies
MModular
Created by Jack Clayton on 9/8/2023 in #questions
Native apple silicon macOS m1 and m2 support
I agree, I wasn't thrilled to add it, so up to you whether it's worth it. There also seems to be some detail in this post that I just found when I asked #mojo-bot-help - I'm going to give the a read, perhaps it will clear things up
110 replies
MModular
Created by Jack Clayton on 9/8/2023 in #questions
Native apple silicon macOS m1 and m2 support
I'm not fully sure what's the relationship between mojo and my system python, but it seems to be importing numpy from the virtualenv.
I have the same/similar question: Can I choose/activate a particular python env for mojo to work with? I normally do this in my notebooks by selecting a python kernel, but since I need to select Mojo as my kernel, the relationship is no longer clear to me @JRX the solution recommended to me for python import problems (and it did work) was to just install miniconda. Not sure if that applies to your situation, but mojo seems to find python packages after install.
110 replies