Modular

M

Modular

This server is the home of the MAX and Mojo community. Join us to chat about all things Modular!

Join

questions

community-showcase

memory leak with DynamicVector

What is the right way to avoid memory leaks? From docs we see that DynamicVector doesn’t call elements destructors. Decorators supposed to create destructor but as far as I can tell you can’t use it manually. So what is the proper way to clean up in the and of the each step in the cycle? ` from utils.vector import DynamicVector...

binary file size

In the first community live stream on youtube at around 36 minutes, Chris Lattner mentions "hello world it's 20K" which I understand means that the binary size of a hello world example could be as low as 20kb. If I mojo build hello_world.🔥 on linux I get a 1.7MB binary. How can I reduce that binary size? Is that 20k a target that should be achievable later? Is it calculated without the runtime that is bundled in the binary? Do I need to enable some kind of optimization?...

Support for Linux is only Ubuntu

Curious what's so special about Ubuntu that it's the only Linux distro that can be supported at the current time?

Plans for a package manager?

Are there any plans to implement a package manager for mojo like pip/pypi, nuget, npm, etc?

Stackoverflow?

Does anyone know how to use Stack Overflow for mojo questions? The mojo tag on Stack Overflow has the following description: SDK for development of webOS 1.x and 2.x apps using JavaScript and HTML. or... Most commonly used to designate plugin development in Maven (Java build tool). For the Perl web toolkit, use [tag:mojolicious] Mojo is also a programming language and superset of Python. Check https://www.modular.com/mojo for more details....

How to use Modulo?

This works print(10%) but I can't use % in a method: ```def is_prime(n): for i in range(2,n): if (n%i) == 0:...

Thread safety

Mojo looks very interesting! Are there any plans to statically prevent data races like what Rust does with the Send/Sync traits (in combination with the borrow checker)?

string chars to uint8

Any examples on how to access string characters and convert them to something similar to python bytes? In general any examples of types conversion would be helpful

Mojo code to python?

I was baking a project and i saw that including somes mojo code in my app could make it 🔥 but my main app is in python, Question: Is it possible to use mojo in python ? I know its possible to do python to mojo though...

How to type a callback?

as in, var callback: whatGoesHere?

newbie needs help with error messages

the code: ``` @register_passable("trivial") struct Item: var name: StringLiteral...

Print statement stops working after array instantiation

I created a custom array here with the help of the devs at one point and when messing around with it noticed that after instantiating it with a trivial int type that it stopped the program without any errors.

Can I call a (compiled) Mojo function from Python?

Otherwise, do we have any ETA for when that is going to be available? It seems like the killer feature for Mojo.

What is the correct way of serving restful api in short and long term in mojo?

Should we keep on using python for that? If we should do it from scratch, or there are already mojo way of doing it, how?

how do you disambiguate function calls

also, can you disambiguate between these two: ```Rust fn mul(self, other: MY_SIMD[type,1]): // splat multiply fn mul(self, other: MY_SIMD[type,simd_width]):...

What kind of list should I use to add struct instances

Example struct: ``` struct Item: var name: StringLiteral fn init(inout self):...

please add support for spacy and fastapi

please add support for spacy and fastapi

GUI related stuffs

I'm wondering if we can use other gui framework like PySide6, PyQt6 since I saw an example in docs using matplotlib, is there any future realease for gui framework easy to integrate with Mojo? any feature like plotting realtime data with pyqtgraph and reach fast fps?

How to add an instance of a struct to a DynamicVector

A total newbie question. Example: struct Item: var name: StringLiteral fn init(inout self):...