#Flux - systems programming language

29 messages · Page 1 of 1 (latest)

storm raft
#

Flux is a compiled systems language, designed to have the power and low level control of C, with the readability and expressiveness of Python.

https://github.com/kvthweatt/FluxLang

Here's an example of taking a bit slice out of a struct:

#import "standard.fx";

using standard::io::console;

struct xx { int a, b; };

def main() -> int
{
    data{4} as u4;
    xx yy = {5,10};
    u4 a = yy[59``63]; // last 4 bits of struct, 10 because 0b1010

    print((int)a);

    return 0;
};

And here's reversing bits:

#import "standard.fx";

using standard::io::console;

def main() -> int
{
    byte x = 55;

    x[0``7] = x[7``0];

    println(int(x));

    return 0;
};

You can take bit slices of bit slices as well.

Flux has seamless FFI with C, everything is stack allocated by default including pointers, and everything is zero initialized by default. You can opt-in to uninitialized declaration like:
int x = noinit;

You can also assign arbitrary bytes to a function pointer, and if its valid machine code for your arch, you can execute that function. Example:

#import "standard.fx";

using standard::io::console;

def main() -> int
{
    byte[] some_bytecode = [0x48, 0x31, 0xC0, 0xC3];  // xor rax,rax ; ret
    def{}* fp()->void = @some_bytecode;
    fp();
    
    return 0;
};

Looking forward to feedback!

GitHub

A new general purpose, statically typed, broadly mid-level, object-oriented systems programming language for precise control over data. - kvthweatt/FluxLang

agile pewterBOT
#

Thanks for your question :clap:, if someone gives you an answer it would be great if you thanked them with a :white_check_mark: in response. This response will earn you both points for special roles on this server.
Flux - My new programming language

lapis palm
#

Looks painful

silk viper
#

Looks creepy, even more than C

storm raft
#

Thanks, it's more like a hardware language crossed into a systems language.

Also here's raytracing done in Flux

storm raft
#

Flux now has a very simple package manager.

ornate swallow
storm raft
#
#import "standard.fx";

using standard::io::console;

be32 x = 5;
le32 y = 10;

def foo(be32 k) -> le32 { return 0; };

def main() -> int
{
    le32 z = foo(y); // Compile error, passing little-endian type to big-endian parameter
    return 0;
};

For those that don’t know, le32 and be32 are defined in the standard types library

#

Compiler now checks endianness for function parameters.

storm raft
#
#import "standard.fx";

using standard::io::console;

be32 x = 5;
le32 y = 10;

def f"{x} {y}"() -> void { println("yay"); };

def main() -> int
{
    f"{x} {y}"();

    return 0;
};

f string literals now supported in function names

agile pewterBOT
#

./run.sh executed by @storm raft <@&1244333275489501295>!

storm raft
#

??

storm raft
#

Compiler can now infer templates from the call site.

#import "standard.fx";

using standard::io::console;

struct myStru<T>
{
    T a, b;
};

def foo<T, U>(T a, U b) -> U
{
    return a.a * b;
};

def bar(myStru<int> a, int b) -> int
{
    return foo(a, 3);
};

def main() -> int
{
    myStru<int> ms = {10,20};

    //int w = foo<myStru<int>, int>(ms, 3);

    int x = foo(ms, 3);

    int y = bar(ms, 3);

    println(x == y);
    return 0;
};

Result: True

storm raft
#
LinkedIn

Systems programming is evolving.

Flux Programming Language is gaining attention by combining the performance of C/C++ with the simplicity developers love in Python. The focus is clear: build faster, safer, and more ergonomic low-level systems without the traditional complexity.

As modern applications demand both speed and developer productivit...

civic glen
#

how much of this language was just made with vibe coding

storm raft
storm raft
storm raft
#

That’s not my image

violet estuary
#

Its ais image

storm raft
#

Yeah that is clearly AI, i didn’t make that tho.

#

I wouldn’t let it have incorrect syntax if I did 😂

#

SharkLabs also didn’t reach out to me first, they just posted it. I had no influence.

storm raft
#

Flux - systems programming language

storm raft
#

In recent news, just got templates debugged in my language, allowing me to make a proper tensor library. Setting up visualization for autograd