Printf - print format
Is there a print format in mojo، how can I rewrite this python in mojo:
```py
def fun (arg):
print(f'arg = {arg}')
bar = [5, 10, 15, 20]...
python decorators
Will decorators imported from python libraries work? If yes, can you provide an example?
Char[X] equivalent in Mojo
Hi I'm new to mojo and I'm trying to learn it.
I have a custom file format defined like so:
in C++
struct Header
{...
Memset
From the docs -
memset memset[type: DType, address_space: AddressSpace](ptr: DTypePointer[type, address_space], value: SIMD[ui8, 1], count: Int) Fills memory with the given value....
Unnecessary nan-checks: performance issue or missing compile options.
I'm not sure whether this is a performance issue or a feature request. I figured lets ask here first.
The issue is a performance regression due to unnecessary nan-check for with (eg.) max and min operations.
```python...
How to rewrite this code into something not ugly
I need to call
shuffle
on a parameter mask of different lengths, the following code is the shortest that I could make. Please fill in the dots to appreciate what would happen with width 1024. Any thoughts are appreciated.
```python
fn my_shuffle[T: DType, width: Int, p: StaticIntTuple[width]](v: SIMD[T, width]) -> SIMD[T, width]:
@parameter...`DynamicVector`, the name
Why is it not called
DynamicArray
? I find dynamic vector a bit tautological, given the vector terminology (likely) comes from C++, which literally means "dynamic sized array"[ref].Determining Tensor datatype at runtime
Hi folks! I'm working on a project where I need to extract a bunch of numeric data from a file, and the datatype for the file data is contained within the metadata for the file.
I want the data within to always be read into a Tensor, but I'm not sure how to handle the datatyping at runtime, since you have to define the Tensor with a datatype at compile time. I have a feeling the answer lies in pointers, but I'm used to Python so I'm still learning about them 🙂
Grateful for any advice!...
Will Mojo ever become Open Source?
Mojo is a great language and has amazing potential but the fact that it is NOT open source like it's predecessor Python, is not cool. So will mojo become open source later on in it's development or will it remain proprietary and closed-source forever?
Lisp/Julia style macros/codegen
Curious if Mojo will feature this. Many benefits, but among other things it would enable language users to add syntactic and code generation features without having to wait for the core language to be updated.
Mojo + GC
Does Mojo support (optional) GC? If so, does it implement a modern GC like the JVM (e.g. ZGC)? If not, does it just do reference counting? GC is important, of course, for workloads with large numbers of short-lived objects, e.g. as is the case for persistent data structures. Wondering how general-purpose Mojo is intended to be.
Concurrency model
Curious how Mojo is getting around the assumed presence of a GIL. What's the concurrency story?
Virtual thread support? ("write async like sync")
Wondering whether Mojo will support writing async code like writing synchronous code, like Java's virtual threads. Hoping to avoid the "function coloring" problem introduced by
async
/await
.
See also https://www.infoworld.com/article/3678148/intro-to-virtual-threads-a-new-approach-to-java-concurrency.html....pattern matching as switch - case
Is it possible to implement upcomming pattern matching more like switch-case in C rather than like in Python in which it is powerful syntax sugar for if-else? My question araises, becase switch-case is much more performant in non-trivial examples and it will be really nice to use it instead of if-else and have improvements in performance because of that
`atof` in Mojo?
Does Mojo currently have a function to convert real numbers represented by strings to Float64's? Something like C's
atof
function?JIT compilation in Mojo
Hi, Mojo parameters are an extremely powerful tool in the language.
Does Mojo also provide (or will provide) JIT compilation mechanisms to convert runtime variables into parameters?...
Function Decorators
Are functions decorators and related syntax supported in Mojo right now, if so, has anyone had any luck with custom decorators? I’m aware of the builtin ones like @value and @register_passable