#🪅-progaming

1 messages · Page 33 of 1

hoary sluice
#

thats my pb by 26 wpm 😭

#

10 words is so unbalanced

valid jetty
#

lmfaoo

hoary sluice
#

i can only monkeytype properly for like a minute, then my muscle memory switches back to qwerty because typing fast always meant im on qwerty

placid cape
#

blom senior

valid jetty
#

look at this beautiful code as a result of lambdas not capturing

struct LoopEnv {
    i32 cx;
    i32 cy;
    i32 *y;
    i32 *x;
    i32 *dir;
    bool *ret;
    HashSet<Triple<i32, i32, i32> *> *visited;
    (i32, i32)[] dirs;
    string[] grid;
};

fn loop(i32 cx, i32 cy, i32 sx, i32 sy, HashSet<Triple<i32, i32, i32> *> *visited, (i32, i32)[] dirs, string[] grid) {
    visited.clear();

    let y = sy;
    let x = sx;
    let dir = 0;
    let ret = false;

    $scoped(fn(LoopEnv *env) {
        while true {
            let triple = $$(*env.y, *env.x, *env.dir);

            if env.visited.contains(triple) {
                *env.ret = true;
                return;
            }

            env.visited.add(triple);
            let tuple = env.dirs[*(env.dir)];
            let ny = *env.y + tuple.x;
            let nx = *env.x + tuple.y;

            if (ny < 0) || (ny >= env.grid.len()) || (nx < 0) || (nx >= env.grid[0].len()) {
                *env.ret = false;
                return;
            }

            if env.grid[ny][nx] == '#' || (ny == env.cy && nx == env.cx) {
                *env.dir = (*env.dir + 1) % env.dirs.len();
            } else {
                *env.y = ny;
                *env.x = nx;
            }
        }
    }, &LoopEnv {
        cx = cx,
        cy = cy,
        y = &y,
        x = &x,
        dir = &dir,
        ret = &ret,
        visited = visited,
        dirs = dirs,
        grid = grid
    });

    return ret;
}
#

and it works with almost no memory allocation now

#

like 4mb by the time it finishes

#

compared to 600+ when it wasnt scoped

placid cape
#

c3 also requires passing values into lambda like that

valid jetty
#

yeah thats where i copied this idea from lol

#

well not really but i copied $scoped

#

except elle doesnt have polymorphism like c3 so you cant have an arbitrary allocator in #env.allocator

#

therefore you dont pass any allocator into $scoped its just always the arena one

#

but i already had an idea of how to do capturing since a while ago

use std/io;

struct Env { i32 a; };
struct Function { Env env; void *func; };

fn add(i32 a) {
    let env = Env { a = a };
    let func = fn(Env env, i32 b) env.a + b;

    return Function {
        func = func,
        env = env
    };
}

fn main() {
    let res = add(13);
    fn *curried = res.func;
    io::dbg((i32)curried(res.env, 26));
}
#

never actually implemented it tho

#

@placid cape @hoary sluice

#

lc.define defenestrated

visual shellBOT
# valid jetty lc.define defenestrated

<:i:1263592450136473684> defenestrate  diːˈfɛnɪstreɪt 

verb

  1. throw (someone) out of a window.
  • she had made up her mind that the woman had been defenestrated, although the official verdict had been suicide
  1. remove or dismiss (someone) from a position of power or authority.
  • the overwhelming view is that he should be defenestrated before the next election
valid jetty
#

ok well this is basically what i did today

#

it looks super weird

#

but it actually works correctly

hoary sluice
fleet cedar
#

Overmorrow?

hoary sluice
#

not commonly used

fleet cedar
#

Neither is defenestrate

hoary sluice
#

i have heard the word defenestrate more often than the word overmorrow or ereyesterday

#

2 times vs 0 times

hoary sluice
placid cape
# hoary sluice there is no commonly used word for the day after tomorrow yet there is a word fo...

Defenestration (from Neo-Latin de fenestrā) is the act of throwing someone or something out of a window.
The term was coined around the time of an incident in Prague Castle in the year 1618 which became the spark that started the Thirty Years' War. This was done in "good Bohemian style", referring to the defenestration which had occurred in Prag...

placid cape
#

"zajtra" means tomorrow

#

"po" means after

#

its just together

valid jetty
#

日本語では「明後日」って言うよ

#

its spelt "asatte"

#

the day after tomorrow

#

for the record thats not what that sentence means lol

#

it means quite literally "in japanese we say 明後日"

fleet cedar
#

That だと sounds strange imo

valid jetty
#

you could probably also say では?

fleet cedar
#

Yeah that sounds more sane

valid jetty
#

yeah

dense sand
#

WTF JE TŘICETILETÁ VÁLKA 🦅

placid cape
hoary sluice
#

@valid jetty i think i just found the worst website

#

its a university campus housing site

#
  1. it looks awful
  2. when you log in it replaces the password with its rsa in the actual password box so firefox and proton try to override the saved password
  3. its supposed to also let you find people to share a dorm with but there is literally no info besides their phone number and email, no starting date, preferences, etc
#

and more than half of the applicants are from india with 123456 as their phone number even tho i saw literally 0 indians at the uni when i went there so im inclined to think they dont actually plan to study there

#

im guessing it was made by a freshman who lived there or by a freelancer for 5$

valid jetty
#

lmfaoooooooooo

#

@royal nymph see this is the kind of thing i was talking about a few days ago

#

at least be happy the password isnt stored in plain text

hoary sluice
#

it is

#

well sometimes

valid jetty
#

but you just said its rsa encrypted

hoary sluice
#

when you sign up they send you an email with
username: <your last name>
password: <city of the uni>#1

royal nymph
#

encrypting passwords seems like a terrible idea lol

hoary sluice
#

then you can change it but youre not forced to

winged mantle
#

i mean on other keyboards i can type at 120wpm with pretty good accuracy

valid jetty
#

oh true

royal nymph
#

you hash

valid jetty
#

usually you would hash

#

yeah

royal nymph
#

encrypting them makes 0 sense lol

#

because what do you encrypt them with?

valid jetty
#

pgp encryption for my password 😍

hoary sluice
twilit sigil
#

Very secure

hoary sluice
#

surely they dont store the private key and just use rsa for hashing

twilit sigil
#

Nobody'll get them then

royal nymph
#

encrypting the password is like locking your key in a safe

hoary sluice
#

oh also you literally just cant log in

twilit sigil
#

Throw the key to the safe into a river

hoary sluice
#

like it just says ur password is wrong after doing the rsa paste thing even tho its stored in my password manager

royal nymph
whole cove
#

i base64 hash my passwords

winged mantle
#

i think it's kind of bad if applying the slightest of pressure to a key presses it without making much sound

hoary sluice
twilit sigil
hoary sluice
#

i rot 13 my passwords

#

(456789 instead of 123456)

twilit sigil
#

We should make people physically log in for maximum security

valid jetty
#

i turn my password into an array of i8 and add the i8s

twilit sigil
#

Gotta go to google HQ to log into gmail

hoary sluice
#

take the x coordinate of your password, multiply it by 100 and then add the y coordinate

valid jetty
#

personally i do a pathfinding to find the optimal password that i should make for each website

hoary sluice
#

the password is actually an elephant and he wants you to simulate 1 trillion rocks

valid jetty
#

the heuristic is the amount of negative reviews on better business bearau

hoary sluice
#

i run my passwords through game of life until it stabilizes

twilit sigil
#

I put all my passwords into one big file, encrypt said file, then divide the password into 4 parts, with a duplicate of each part, then bury each part in a different part of the country

hoary sluice
#

if im unlucky it wont stabilize and then i just dont log in

hoary sluice
boreal minnow
#

Can i talk about JavaScript here?

valid jetty
#

i print my passwords to a physical piece of paper and use refraction of glass to distort it and then use a large language model trained on decyphering characters through reflacted glass to get back the password

twilit sigil
valid jetty
twilit sigil
#

So I have to fight each person to the death to get each part

boreal minnow
#

Okay!!!

#

I need ideas, what are some JavaScript libraries that are very good at managing state, similar to the Observables approach? I need a good way to store state in an object and use it for my UI components

#

I currently use my modified Svelte Stores code

#

But I think there's a better thing I can use

valid jetty
twilit sigil
#

Oh I was about to come up with an original thought but somebody has already made it

#

Curse you whoever already made parallelized bogosort

valid jetty
#

i have an idea for how i can make a GC

#

every so and so timeframe, i go through every arena, and i see if there are allocations that point to something within another arena's buffer and then i mark the whole arena as reachable and dont free it

#

and then every arena which isnt reachable is freed

hoary sluice
#

@valid jetty our sleep schedules are slowly syncing

#

every day im going to sleep later

#

its 11:30 and im playing bedwars

placid cape
#

idk if i should say "good" or "bad" lol

hoary sluice
#

bad

#

@valid jetty @placid cape is there fzf in zed

valid jetty
hoary sluice
hoary sluice
valid jetty
hoary sluice
#

@placid cape

#

so u dont have to use mouse

placid cape
#

ohh

#

I think yes

#

cmd-p

placid cape
#

well at least js is not first lol

valid jetty
#

cmd + shift + p is command pallete

hoary sluice
hoary sluice
valid jetty
#

lmao

hoary sluice
#

every day i say im gonna go to sleep at 10 today

#

it never works

#

so today i just gave up

valid jetty
#

i lost that mindset about 2 years ago

#

so i just kinda sleep whenever i feel like it

hoary sluice
#

it worked in aoc but now i have nothing to wake up for

valid jetty
#

lmao exactly

hoary sluice
#

better to go sleep early and wake up even earlier

#

but its hard

placid cape
#

good night

#

gonna sleep

hoary sluice
#

gn

valid jetty
#

i literally had like a 6 hour day today i think

#

im considering to do $ for various things other than mem::scoped

mem::scoped <-> $scoped
io::assert <-> $assert
io::todo <-> $todo
io::unimplemented <-> $unimplemented

#

solely because io:: is tedious

#

and i dont wanna pollute the global namespace

winged mantle
#

use €

valid jetty
#

lmao

#

€scoped

winged mantle
#

i had to enable dead keys to type that...

#

(bought us keyboard by mistake 🤮 )

valid jetty
#

on a real note though i have a distinction between the 4 common prefixes

#

&x -> addr of x
%x -> ugly (and modulus)
#x -> compiler builtin
@x -> attribute for functions and structs
$x -> std function aliased for ease of use (???)

winged mantle
#

$stdlib_global
€imported_symbol
£project_global

valid jetty
#

😭

winged mantle
#

genius

valid jetty
#

beautiful

#

¢x -> cents required to dereference x (we live in a society)

winged mantle
#

make it xp for british users

valid jetty
#

LMAO

#

£0.0x

winged mantle
#

php but good

USDnum = 1;
USDnum++;
echo USDnum;
valid jetty
#

true,,,,,,,,,,,,,

hoary sluice
#

I think it fits well for lambdas

fleet cedar
#

$ should be for blocking functions , which are expensive to call

hoary sluice
#

huh

valid jetty
#

lmfao

valid jetty
#

depending if you need multiple lines or not

#

(this is not a functional language)

hoary sluice
#

gn

valid jetty
#

sure

#

gn

#

i made sleeker variadics syntax

#
use std/io;

fn add(ElleMeta meta, ...args) {
    let res = 0;

    for let i = 0; i < meta.arity; i += 1 {
        res += args.yield(i32);
    }

    return res;
}

fn main() {
    let sum = add(1, 2, 3, 4, 5);
    io::dbg(sum);
}
#

as it turns out the variadic ptr passed to vastart should not be big enough to hold the elements you need it should be of the size of valist (which is different on all platforms so i just used the biggest one)

valid jetty
#

i think it was a good idea to add this to the docs

valid jetty
#

i think i can make it @ instead of $

#

@assert and @dbg is much nicer than $assert and $dbg

valid jetty
#

ok this might be a bit harder than i initially intended because of how i did it in the lexer

valid jetty
#

@royal nymph generics in C

#include <stdio.h>

#define Foo_define(T) \
typedef struct { \
    T x; \
} Foo_##T; \
\
T Foo_##T##_get(Foo_##T *self) { \
    return self->x; \
} \

#define Foo_get(T, self) Foo_##T##_get(&(self))
#define Foo(T) Foo_##T

Foo_define(int)
Foo_define(float)

int main() {
    Foo(int) foo1 = { 39 };
    Foo(float) foo2 = { 4.2 };
    printf("%d, %f\n", 
        Foo_get(int, foo1),
        Foo_get(float, foo2));
}
#

or even simpler

#include <stdio.h>

#define Foo_define(T) \
typedef struct { \
    T x; \
} Foo_##T; \

#define Foo(T) Foo_define(T); Foo_##T

int main() {
    Foo(int) foo1 = { 39 };
    Foo(float) foo2 = { 4.2 };
    printf("%d, %f\n", foo1.x, foo2.x);
}
valid jetty
valid jetty
#

yeah

valid jetty
#

you can interop with variadic elle code

#

holy shit

#

the "lib"

// variadic.le
pub fn add(ElleMeta meta, ...args) @volatile {
    let sum = 0;

    for i32 i = 0; i < meta.arity; i += 1 {
        sum += args.yield(i32);
    }

    return sum;
}

ellec variadic.le -c -nsm

consuming from c

// variadic.c
#include <stdio.h>

typedef struct {
    char **exprs;
    char **types;
    int arity;
    char *caller;
    char *file;
    int line;
    int column;
} ElleMeta;

extern int add(ElleMeta meta, ...);

int main() {
    printf("%d\n", add((ElleMeta){ .arity = 4 }, 1, 2, 3, 4));
}

cc -o variadic variadic.c variadic.o

consuming from elle

// variadic_impl.le
// ofc itll work out of the box in elle
use std/prelude;

external fn add(ElleMeta meta, ...) -> i32;

fn main() {
    $dbg(add(1, 2, 3, 4));
}

ellec variadic_impl.le variadic.o && ./variadic_impl

#

i guess it makes sense

#

im actually really glad i implemented ElleMeta because it allows for very easy C interop

#

as its runtime based and not a compiler gimmick (all the compiler does is create the struct)

#

ok good night

#

6:16am

#

😭

dense sand
valid jetty
#

good morning

ornate quiver
#

you are crazy

#

you slept for 4 hours??

hoary sluice
#

@valid jetty you need to move to america

#

if you sleep like this in japan you will go to sleep in the morning and wake up in the evening

valid jetty
#

technically no

#

6am here is 9pm in japan

#

so i would be going to sleep at 9pm and waking up at 1am

#

also who tf decided to call it japan

#

in japanese japan is 日本 (nihon)

placid cape
#

starlight is amazing

placid cape
#

wow i slept for 7h today

valid jetty
#

you still cant pass structs into variadic functions lmfao

#

at least you can do this

#

also this is really weird that it doesn’t work because it’s the same pointer and the same operation is being performed

pearl stagBOT
valid jetty
#

the address of a struct is just the same value interpreted as a pointer

dense sand
#

gotta love java

placid cape
valid jetty
#

yes

#

there’s a few

pearl stagBOT
# valid jetty that’s not all of them tho there’s a few more https://github.com/acquitelol/elle...

io.le: Lines 147-152

external fn io::dbg(ElleMeta meta, ...args) @fmt @alias("$dbg");
external fn io::panic(ElleMeta meta, string fmt, ...) @fmt @alias("$panic");
external fn io::die(ElleMeta meta) @alias("$die");
external fn io::todo(ElleMeta meta, string message) @alias("$todo");
external fn io::unimplemented(ElleMeta meta) @alias("$unimplemented");
external fn io::assert(ElleMeta meta, bool condition, string message) @alias("$assert");
hoary sluice
#

@valid jetty```rs
'>' => if let Some('=') = self.next() {
self.advance();
TokenKind::GreaterEqual
} else {
TokenKind::Greater
},

#

ignore the indenting

fleet cedar
#

Looks like a if self.eat('=') { Ge } else { Gt } to me

hoary sluice
#

yes

#

it doesnt eat immetiately tho

#

my parser does that, idk if lexer should too

fleet cedar
#

Sure you can call it eat_if if you prefer

hoary sluice
#

self.next_is(TokenKind::Equal)

placid cape
#

if eat() eats it

hoary sluice
#

.eat doesnt eat if its not =

#

its very picky

placid cape
#

ohh

#

makes sense

hoary sluice
#
fn consume_if(&mut self, c: char) -> bool {
    if matches!(self.next(), Some(cc) if cc == c) {
        self.advance();
        true
    } else {
        false
    }
}

hoary sluice
#

ty

valid jetty
#

mine just gets the job done lol

#

i don’t really care about semantics

hoary sluice
#

wtf is this

pearl stagBOT
hoary sluice
#

u advance inside the match arms??

valid jetty
#

yeah

#

fine grained control

hoary sluice
valid jetty
#

set it to a variable and look at its type

hoary sluice
#

i meant it should detect that Ok(func()?) is just func()

valid jetty
#

Ok(func()?) == Ok({ let x = func(); if x.is_ok() { x.unwrap() } else { return Err("".into()) } })

#

even though its technically the same thing its like

#

too complex for the compiler to expand

fleet cedar
valid jetty
#

oh true that too

hoary sluice
#

all my errors are from my error mod

valid jetty
#

what is Error

#

oh i see

hoary sluice
valid jetty
#

yeah i found it

#

did you not work on it for a while or do you just have 5 days of commits lmao

hoary sluice
#

wdym

valid jetty
#

theres been no updates for 5 days so did you just not have time or did you stack a ton of changes into 1 big push

hoary sluice
#

i was doing aoc

valid jetty
#

oh

#

fair

hoary sluice
#

its getting there

valid jetty
#

css husk

hoary sluice
#

i wonder if ill have more rust than kt when this is done

valid jetty
#

lmao i cant really talk

#

html is in my top languages somehow

hoary sluice
#

javascript husk

valid jetty
#

no idea where that is 😭

#

could be rosiecord

hoary sluice
#

how are you not in a mental facility after writing this much js

valid jetty
hoary sluice
#

my entire portfolio is just aoc

valid jetty
#

account-info??????????

#

autobookwork?????

hoary sluice
valid jetty
#

its a scraper for sparx

#

😭

hoary sluice
#

🗿 🗿

valid jetty
#

lMAO

hoary sluice
#

why is that site purple

valid jetty
#

wha

hoary sluice
#

ive been on it before

valid jetty
#

idk

#

i used to have it as my homework website for maths last year

#

it forces you to write down your working and punishes you if you dont

#

so i wrote a thing to automate that

hoary sluice
#

is it one of those where you have to show your work and if the spaces dont match its wrong

valid jetty
#

no

#

it shows you a multiple choice thing

dense sand
hoary sluice
#

so true

fleet cedar
valid jetty
#

the answers are very concrete which makes it very easy for me to go and take the latex from the question and take the answer and store them

fleet cedar
#

Since teachers insisted that I had to make up extra intermediate steps that I didn't do

valid jetty
#

(these arent real questions)

valid jetty
dense sand
valid jetty
#

no it stores latex as a string in json lol

#

that is latex

#

or well close enough

#

i rewrote their cursed latex system thing

dense sand
#

why is here so much smart people, i feel dumb for not knowing how to solve integrals at 17 😭

pearl stagBOT
# valid jetty https://github.com/acquitelol/azalea/blob/no-updater/src/core/components/katex/r...

renderLatex.ts: Lines 13-52

export function renderMixedTextToString(text: string, suppressWarnings?: boolean) {
    const tagStack: string[] = [];
    const parts = text.match(patterns.maths);

    if (parts?.length < 1) {
        return '';
    }

    let isMaths = false;

    for (let i = 0; i < parts.length; i++) {
        // The '$' character is used as a switch to enter latex maths mode
        // For example, "some normal text and then $3x^2+5$"
        // Where the '3x^2+5' would render in latex instead of plain text.
        // The first '$' enters maths mode and then the second '$' exits it.
        if (parts[i] === '$') {
            isMaths = !isMaths;
            parts[i] = '';

            continue;
        }

        if (isMaths) {
            try {
                parts[i] = renderMathsToString(parts[i]);
            } catch (exception) {
                parts[i] = `<code class="invalid-math">${htmlEscape(parts[i])}</code>`;

                if (!suppressWarnings) {
                    logger.warn(exception, 'Invalid Maths:', parts[i]);
                }
            }
        } else {
            parts[i] = htmlEscape(parts[i].replace('\\$', '$'));
            parts[i] = replaceLatexTagsWithHtmlTags(parts[i], tagStack);
        }
    }

    return preprocessText(parts.join(''));
};
valid jetty
#

basically you can do abc $latex_{here}$

valid jetty
#

integrals are much easier than they seem

hoary sluice
valid jetty
#

at least 1 dimensional integrals are pretty easy

hoary sluice
#

only math i know is what i learned from aoc and 3b1b videos

valid jetty
#

consider khan academy

hoary sluice
#

(graph theory, set notation, and linalg from 3b1b)

valid jetty
#

very good videos and the multivariable calculus ones are made by grant sanderson (the same person who runs 3b1b)

hoary sluice
valid jetty
hoary sluice
#

still too slow

#

an hour to explain basic matrix operations is just too long

#

he writes down every step

valid jetty
#

if you understand it already then go straight to the questions lol

#

noones stopping you

hoary sluice
#

3b1b explains really well

valid jetty
#

yeah he explains very well in mv calc too

hoary sluice
#

wtf lol

hoary sluice
valid jetty
#

pls 1.5x

placid cape
hoary sluice
#

evil

placid cape
#

i have so much python

valid jetty
#

@placid cape you will use this

function callableArray<T>(...array: T[]) {
    const _closure: (index: number) => T = (() => {}) as any;
    const typedClosure = _closure as unknown as typeof _closure & typeof array;

    array.toString = function() {
        return `[${array.map(element => JSON.stringify(element, null, 2))}]`;
    }
    
    const proxy = new Proxy(typedClosure, {
        get(_, prop: string, __) {
            return !isNaN(+prop) ? array[+prop] : Reflect.get(array, prop, array);
        },

        set(_, prop: string, handler) {
            !isNaN(+prop) && (array[+prop] = handler)
            return true;
        },

        apply(_, __, [index]) {
            if (typeof index === 'number') {
                return array[index];
            }

            return null;
        }
    });

    return proxy;
}

const arr = callableArray("a", "b", "c");
console.log(arr[0] === arr(0)); // true
placid cape
#

you're working on elle -> js ?

valid jetty
#

no lol

#

its just a thing i wrote a while ago

placid cape
#

why

valid jetty
#

idk

placid cape
#

but thanks anyway

valid jetty
#

ive done all kinds of cursed things with js

#

omg i just found this

const findReact = <T extends Element>(element: T | null, traverseUp = 0) => {
    if (!element) return null;

    const key = Object.keys(element).find(key => {
        return key.startsWith('__reactFiber$')
            || key.startsWith('__reactInternalInstance$')
            || key.startsWith('__reactContainer$');
    }) ?? '';

    const elementFiber = element[key];

    if (!elementFiber) return null;
    if (key.startsWith('__reactContainer$')) return elementFiber;

    if (elementFiber._currentElement) {
        let computedFiber = elementFiber._currentElement._owner;

        for (let i = 0; i < traverseUp; i++) {
            computedFiber = computedFiber._currentElement._owner;
        }

        return computedFiber._instance;
    }

    const getComputedFiber = fiber => {
        let parentFiber = fiber.return;

        while (parentFiber && typeof parentFiber.type === 'string') {
            parentFiber = parentFiber.return;
        }

        return parentFiber;
    };

    let computedFiber = getComputedFiber(elementFiber);

    for (let i = 0; i < traverseUp; i++) {
        computedFiber = getComputedFiber(computedFiber);
    }

    return computedFiber;
};

export default findReact;
#

it takes a html element and finds the corresponding react fiber for it

valid jetty
#

if Java had true garbage collection most programs would delete themselves upon execution

#

LMAO i found this in the llvm codegen for a C project

@.str.1 = private unnamed_addr constant [231 x i8] c"There is no error. The developer of this software just had a case of \22Task failed successfully\22 https://i.imgur.com/Bdb3rkq.jpg - Please contact the developer and tell them that they are very lazy for not checking errors properly.\00", align 1
valid jetty
#

i found a way to find GC roots on the stack

#
use std/prelude;

fn other(void **base) {
    i32 __x;
    void **stack_start = &__x;
    void **stack_base = base;

    while stack_base > stack_start  {
        $dbg(*stack_base);
        stack_base -= 8;
    }
}

fn main() {
    i32 __x;
    void *a = #env.allocator.alloc(24);
    io::cprintf("%p\n", a);
    other(&__x + 8);
}
#
**0x128008000**
[test.le:9:13] void* *stack_base = <unknown at 0x16ee2aa20>
[test.le:9:13] void* *stack_base = <unknown at 0x100000000>
[test.le:9:13] void* *stack_base = <unknown at 0x100fe4100>
[test.le:9:13] void* *stack_base = <unknown at 0x100fd7ef0>
[test.le:9:13] void* *stack_base = <unknown at 0x16ee2a710>
[test.le:9:13] void* *stack_base = <unknown at 0x100fe5c80>
[test.le:9:13] void* *stack_base = <unknown at **0x128008000**>
#

basically a is a ptr to the heap held by a stack variable and i found it from a function that isnt the function where it was created

#

this is really finnicky but i think it can work

valid jetty
#

this may work

use std/prelude;

fn other(void **base) {
    i32 __x;
    void **stack_start = &__x - 1e4;
    void **stack_base = base;

    while stack_base > stack_start {
        let current = #env.allocator.current;
        let p = *stack_base;

        while current {
            let next = current.next;

            if current.buffer <= p && p < current.buffer + current.used {
                $dbg(p);
            }

            current = next;
        }

        stack_base -= 8;
    }
}

fn main() {
    i32 __x;
    void *a = #env.allocator.alloc(24);
    void *b = #env.allocator.alloc(24);
    io::cprintf("root: %p\n", a);
    io::cprintf("root: %p\n", b);
    other(&__x + 8);
}
#

no idea if its consistent

valid jetty
#

ok im slowly figuring something out

#

i have this

.text
.balign 4
.global _get_stack_pointer
_get_stack_pointer:
    mov x0, sp
    ret
#

and i can

external fn printf(string formatter, ...);
external fn get_stack_pointer() -> void *;

fn main() {
    printf("%p\n", get_stack_pointer());
}
#

and this gives me the stack boundary

#

but i think theres gotta be a neater way to do this right

hoary sluice
#

@valid jetty im starting to get demotivated about icps because rust is so perfect and awesome

#

rust has 0 issues

#

its the perfect language

valid jetty
#

until you try to do anything with aoc in it and get stuck in as usize hell

hoary sluice
#

i am already in .toInt() hell in kotlin

#

especially with intcode

valid jetty
#

lmao

hoary sluice
#

cause intcode requires long indices

valid jetty
#

this is why you use a real programming language like javascript

hoary sluice
#

so true??

valid jetty
#

i just wrote a huge fucking post on qbe forums lets hope qbe devs know more about frame pointers than i do

#

i could probably look at the qbe source code right

#

but

#

actually maybe i cant

#

oh right i think i remember why i cant look through the source code now

#

Fn *fn is a linked list of function pointers btw

hoary sluice
#

Why is it still not rewritten in rust

valid jetty
#

probably noone can understand it enough to write it in rust

dawn ledge
ornate quiver
#

every type is a 3 letter abbreviation

#

😭

hoary sluice
#

Bro whats the point of abbreviating link to lnk

dawn ledge
#

you dont get it

#

one keystroke less

ornate quiver
#

rosie try to write readable code challenge

valid jetty
#

i didn’t write that code 😭

#

it’s part of the code for the intermediate representation i’m using for my compiler

placid cape
valid jetty
placid cape
#

you'll not regret it

#

you'll be #1 every day

dawn ledge
valid jetty
#

i also got demotivated when i saw just how much work there is to do

#

but here we are

dawn ledge
#

rust is a bit verbose

valid jetty
#

but it has a lot of features that i love

hoary sluice
hoary sluice
#

kotlin is already like the best option i have

hoary sluice
#

its the good kind of verbose

dense sand
#

gonna just copy paste my question here:

Guys I need a bit of help, is there any way to parse out Javadocs into a json-compatible format? What I've been doing till now is that I just pulled up the class source and parsed the javadoc out with javaparser and serialized the objects into json, but its quite slow, given it has to parse the whole file. The other option would be to directly parse the html of the javadoc page, but the structure is quite complex and unintuitive. Any other ideas perhaps?
if anyone would know how to cut the loading times, lmk. i already cache the result in postgres db

placid cape
#

tree sitter

formal belfry
#

tree sitter so fucking horrible

dense sand
still jolt
#

I'm a chair sitter myself ​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

valid jetty
#

why do you have a makefile, package.json, Package.swift, pyproject, setup.py, go.mod, CMakeLists.txt, Cargo.toml

#

😭

#

blom depends on every programming language ever

hoary sluice
#

wheres the package.icps

dense sand
#

build.gradle.kts where

hoary sluice
#

kotlin script is too unstable and we will be staying with groovy in prod

dense sand
dawn ledge
valid jetty
#

build.zig where

dawn ledge
#

omg no

placid cape
#

i just did tree-sitter-cli init

#

and it generated everything

frosty obsidian
#

kotlin buildscript my beloved

placid cape
#

I would never use groovy

jade stone
#

i love type inference

nimble bone
#

oh u used template

serene elk
kind ocean
#

program

jade stone
#

is it ? "string" as const : "regex" as const

#

if so

serene elk
#

both strings I guess you are forced to that

jade stone
#

i just put an explicit return type blobcatcozy

valid jetty
hoary sluice
#

also why r u awake

valid jetty
#

silly

jade stone
#

thats just wrong

valid jetty
#

wait what are you even trying to do

jade stone
#

have findType be infered as "string" | "regex"

valid jetty
#

ah

placid cape
agile crane
#

how can i set a "status" in plugin?

#

status i mean like i have "eshkeree"

valid jetty
#

youre returning an object mark the whole object as const

#

(i did not spend 3 hours on this that was just the first chance i had to go on tsplayground lol)

hoary sluice
#

who desinged this shit

fleet cedar
#

What should they be then?

hoary sluice
#

whats wrong with ? string : regex

#

nobody has types as strings besides ts

valid jetty
#

what

fleet cedar
#

Yeah because most languages actually have types

valid jetty
#

this is just types as values

#

lmao

#

that is saying a is either the literal string or the literal regex

fleet cedar
#

Python also uses typing.Literal fairly often

hoary sluice
#

is it because regex is a valid identifier in js and it needs to be a superset of js?

valid jetty
#

what

fleet cedar
#

/foo/ is not a valid identifier what are you talking about

hoary sluice
#

why is it behind a :

fleet cedar
#

Uh

#

You're not making sense

#

Consider making sense instead of not making sense

hoary sluice
#

oh wait i get it

valid jetty
hoary sluice
#

i forgot js has objects

valid jetty
#

this is why its useful

fleet cedar
#

That function returns a value of the type "the literal 'string' or the literal 'regex'"

valid jetty
#

yep

#

that

hoary sluice
#

why is that a thing

valid jetty
#

because the typescript type system is very powerful

fleet cedar
hoary sluice
fleet cedar
#

Quite

fleet cedar
#

That's significantly less powerful

hoary sluice
#

yes like all other languages

fleet cedar
#

I'm quite a fan of knowing "when I index this object with this specific string, I get an int"

hoary sluice
#

if you want "string" | "regex" then make an enum

fleet cedar
#

It's quite more powerful than "when I index this object with any string, I get an int"

valid jetty
#

you can also do type narrowing

valid jetty
fleet cedar
#

Js does not have enums

valid jetty
#

ts does

hoary sluice
#

that just seems extremely bug prone

hoary sluice
valid jetty
#

idk types in ts are completely compile time so it is

#

yeah you can do this

hoary sluice
#

can you index an object by enums

#

and what does this transpile to

valid jetty
#

string literals being valid types is just a byproduct that types can be values

hollow summit
#

guys help
how would i send a message with a vencord plugin

#

like is there a function to send a discord message

valid jetty
#
"use strict";
var Result;
(function (Result) {
    Result[Result["String"] = 0] = "String";
    Result[Result["Regex"] = 1] = "Regex";
})(Result || (Result = {}));
function isFoo() {
    return true;
}
function x() {
    return {
        a: isFoo() ? Result.String : Result.Regex
    };
}
const res = x().a;
const things = {
    [Result.String]: 1,
    [Result.Regex]: 2
};
const a = things[res];
``` transpiled
hollow summit
fleet cedar
#

How would you write something like { type: "none" } | { type: "some", value: int } with enums

hoary sluice
hoary sluice
#

make value enums

fleet cedar
valid jetty
#

@hoary sluice how would you do this if string literals couldnt be types

hoary sluice
#

idk if it does cause i dont use ts

median root
fleet cedar
hollow summit
#

if not ill find it myself

#

ok found it

hoary sluice
fleet cedar
#

I find unions of literals to be a very elegant model for what it is

valid jetty
#

yeah

median root
fleet cedar
#

You couldn't type objects if values weren't types

#

Well, they'd surely add some other way to specify that, but I doubt it'd have the same elegance

hollow summit
#

can someone help i wanna send a message with custom body and nonce

fleet cedar
#

Why custom nonce

#

Very weird thing to do

valid jetty
#

btw @hoary sluice typescript type system is just a functional language

median root
#

I'm pretty sure the discord api might let you work with custom message stuff

valid jetty
#

or i guess

hollow summit
median root
#

The "Create Message" endpoint according to some guy on github

hoary sluice
fleet cedar
#

Probably because not turing complete was not a design goal

hollow summit
#

send link

fleet cedar
#

Are you making a bot or a plugin

median root
hollow summit
#

like this?

#

it doesnt have the token tho

fleet cedar
#

RestAPI already has the token, doesn't it?

hollow summit
#

oh really

#

hooray

#

yay

#

finna change the url and send the token to an API and then send your token to all your friends

#

is there a delete message endpoint too

fleet cedar
#

Considering messages can be deleted, it seems reasonable to assume three's an endpoint for that

hollow summit
#

yea but like

#

whats the constant

#

uhh

#

name

fleet cedar
#

Look it up in the source

#

Or the api docs

#

Or devtools

#

Or probably a few other methods

nimble bone
#

also if your only goal is to look cool on messagelatency ur just an idiot

hollow summit
#

uhh no

#

thats not the goal

hoary sluice
hollow summit
#

uhh how do i capture the response from RestAPI

#

or is it impossible

#

e.g. after sending the message with RestAPI, get the message id from the response

hoary sluice
#

its impossible :((( 😭 husk

hollow summit
#

wait actually

hoary sluice
#

no lol

hollow summit
#

how

#

tell me thy ways

hoary sluice
hollow summit
#

🙏

hoary sluice
#

i would but idk discord api

hollow summit
#

pruh

dawn ledge
#

perhaps a console.log would help

placid cape
#

^^

hasty vessel
hollow summit
#

:P

dense sand
jade stone
hollow summit
#

it uses the DELETE method

#

so idk

#

heplp

#

im too dumb for this

hoary sluice
hollow summit
#

oh i could use FluxDispatcher

#

nice

lavish cloak
#

tldr: how do i setup mail config for my custom domain???

||Hey chat, my school has hired me for their IT department and im responsible for setting up things like the website and online enrollment, etc. School's like one year old so we have nothing yet, and so I've bought an edu domain and have gotten it set up for the website and stuff, but how do I set up the email thing? Like I want teachers and the principal to have a name@school.edu email that they can both receive and send mails to wherever, like how do i do that?? I use riseup for my personal domain email but idk if it's fit for a school. I've been on exchange programs to other schools and I peeked and I can see their teachers just google the word "email log in" and click on a purple link down there and it asks for email and password, they enter their @school.edu email and voila, they can read and send mails from that web portal. Wtf service are they using??? can i do that for free too??? I'm not looking to self host or have a server up locally at school. Any suggestions? I've set up the domain in cloudflare dns but haven't configured anything yet, only some A records and CNAMEs. No mail dns configs. what i do?????????||

valid jetty
#

i setup a sort of runtime environment thing lol

#

i have this

let frame_addr_dir = format!("{STD_LIB_PATH}/{RUNTIME_PATH}/frame_addr");
let kinds = fs::read_dir(&frame_addr_dir)
    .expect(&format!(
        "{RED}Failed to read directory {frame_addr_dir}{RESET}"
    ))
    .map(|x| x.unwrap().file_name().to_str().unwrap().to_string())
    .collect::<Vec<String>>();

if !kinds.contains(&format!("{ARCH}.s")) {
    panic!("{RED}Failed to find a valid frame address pointer assembly for your architecture ({ARCH}){RESET}");
}

let frame_addr_asm = format!("{frame_addr_dir}/{ARCH}.s");
let frame_addr_out = Path::new(&output_path)
    .with_extension("o")
    .to_str()
    .unwrap()
    .to_string();

let _ = Command::new(linker_path.clone())
    .args(vec![&frame_addr_asm, "-o", &frame_addr_out, "-c"])
    .output()
    .expect(&format!(
        "{RED}Failed to execute CC for {frame_addr_out}.{RESET}"
    ));

args.push(&frame_addr_out);
hoary sluice
#

and thats probably the most accepted option

lavish cloak
#

oh

valid jetty
#

and then different asm for each arch

.text
.balign 4
.global ___internal_get_frame_address
___internal_get_frame_address:
    mov x0, x29
    ret
.text
.globl    __internal_get_frame_address
.p2align    4, 0x90
.type    __internal_get_frame_address,@function
__internal_get_frame_address:
    movq    %rbp, %rax
    retq
``` (only arm64 and x86_64 for now)
lavish cloak
#

how do i set that up

hoary sluice
#

if you tell your teachers they need to log in to protonmail its probably just gonna confuse them

formal belfry
#

school using proton mail would be so fire

lavish cloak
#

but how will that work

#

create new account in outlook or proton for each teacher for name@school.edu?

hoary sluice
#

what type of school is it

lavish cloak
#

high

hoary sluice
#

technical or normal

lavish cloak
#

private

#

oh

hoary sluice
#

is it focused on it

lavish cloak
#

urr it's a tech school but normal ig?

#

yes

#

we even self host our internet (i configured it and used two routers for one LAN and the entire school wifi went out thumbsup)

hoary sluice
#

i mean if you want it centralized you pretty much have to pick between outlook and google workspace

lavish cloak
#

wdym centralized

#

isnt google workspace like

hoary sluice
#

if you want admins to be able to read students emails

lavish cloak
#

paid?

nimble bone
#

you aren’t finding anything good for free

lavish cloak
#

oh ok

#

outlook paid too?

nimble bone
#

yeah

#

most of the time ur gonna pay per user i think

hoary sluice
#

outlook has meh free tier and like 5$ per user per month, google has 5$ per user per year

lavish cloak
#

bruh

#

we have maybe 1000 students

hoary sluice
#

id personally do protonmail but idk if admins being able to read student emails is a requirement

#

most schools are heavily microsoft integrated

nimble bone
hoary sluice
#

windows pcs, outlook email, a windows local domain thing to log in, admins can change student passwords

hoary sluice
nimble bone
#

make then not change it

hoary sluice
#

you can save their recovery phrases

hoary sluice
#

@valid jetty have u used rust outside elle

lavish cloak
valid jetty
hoary sluice
hoary sluice
valid jetty
placid cape
#

wuhuuu own syntax highlighting

#

ignore the horrible colors, treesitter

valid jetty
#

@hoary sluice qbe devs are so smart lol

#

idk why i didnt think of this

#

i can just make C file and take advantage of the C compiler to compile the C file and link with the object

#

instead of needing to write seperate assembly for each platform

#

i can just do this

void *__internal_get_frame_address() {
    return __builtin_frame_address(1);
}
valid jetty
valid jetty
#

garbage collection soon now

#

i just need to find these roots aswell as roots in the heap itself and then recurse from there

placid cape
#

🔥

hoary sluice
#

isnt the whole point of qbe that you dont need to do that

valid jetty
#

yes

#

but what im doing is also quite unconventional lol

#

or well

#

its not the most basic program

valid jetty
#

not really that complicated just returns rbp/x29

strange olive
#

is anyone here experienced with how discord handles voice connections?

#

im working on a plugin for using soundboard sounds for free without nitro by manually sending them over a voice udp socket

#

so far ive hijacked the original socket but whatever data i sent through it nothing happens so im wondering if discord maybe blocks packets coming from a different port

#

could also be a timing issue because i have to sync sequence and timestamp between the 2 connections

valid jetty
#

if it’s a technical school the students would prefer that anyway probably

lavish cloak
#

ah yeah

jade stone
#

(i have experience with incoming connections, but not outoging connectoins

dense sand
#

can someone here work with cheerio

strange olive
jade stone
placid cape
dense sand
# placid cape i used it few times

im trynna just quickly get table rows and theirs content into 2 dimensional array, but im getting string[] as results(almost like its being flattened) any idea why,

#

oh nvm i got it now :D

hasty vessel
#

I forced chatgpt to make a pygame os and it is just horrible

strange olive
jade stone
strange olive
#

oh alright thanks

hoary sluice
#

@valid jetty @placid cape

#

it doesnt just say this anymore

#

now time to make it print the arrows pointing to the code

hoary sluice
#

Wtf happened to bitcoin today lol
i think holiday ended so people went and bought

placid igloo
#

programing

hasty vessel
spark tiger
#

everything about rust seems too frustrating to me for some reason. like even such simple things that i can easily do in other languages gets very confusing. the only languages i know are python and c#, i guess the fact that all the time i've coding in high level languages may be the reason of that hard uh adopting to rust?

#

like every time i try to do something, try to port something to rust i quickly after abandon this idea thinking "jfc why couldn't it be any easier in rust as in X language"

#

and this kinda annoys me and makes me sad because i do want to learn languages like rust, c (maybe even zig), but i keep thinking there's not much point in it if doing it in a higher level language that i already know is much easier to me

hasty vessel
#

the command is "npm i pee"

hoary sluice
spark tiger
hoary sluice
#

but its also fast

#

that was kinda the point

#

of rust

valid jetty
#

rust is high level but provides you low level control if you need it

spark tiger
# hoary sluice https://github.com/rust-lang/rustlings

i mean i think the problem is not being used to reading and writing rust code. like in python there was basically like a single way of solving a problem while in rust there's just no basic one, you have to make it yourself which is the problem. with so many ways of making the same thing, it gets a bit confusing. like how can i be sure the way i choose is fast enough

valid jetty
#

you dont need to

#

you just need to be consistent with the way you write your code

#

if something is slow in rust it will be slow anywhere else too

spark tiger
hoary sluice
#

there is always something that is better than everything else in a given context

valid jetty
#

i think i understand where theyre coming from

hoary sluice
#

option vs result vs panic?

#

that type of stuff?

valid jetty
#

match x vs x.unwrap() vs x? vs x.expect vs whatever

#

yeah

hoary sluice
valid jetty
#

there is but there is also a lot of ways to do that

hoary sluice
#

but one of them matches the context the best

valid jetty
#

i guess

spark tiger
# hoary sluice that type of stuff?

the first thing i tried to do in rust was to port my python that parses a binary file. what seemed very easy in python became a PITA in rust. in python i could just do struct.unpack('I', file.read(4))[0] in order to simply read a u32 (either LE or BE, don't remember what that I stands for) from the file while in rust there are like ten different methods i've found on forums, ten different libraries and it's just very very confusing to me

#

i've already asked a similar question here if you remember

hoary sluice
#

ohh that

#

didnt @fleet cedar show u a short way?

spark tiger
#

i mean his way used a 3rd party crate

#

and like sure i can use it

#

but i'd really like to avoid using libs for such a simple task

#

though maybe that's not how things work in rust. like yk in python the standard libraries have like so much stuff, you rarely need to use other libs unless it's a big project

hoary sluice
#
let mut file = File::open("ur file")?;
let mut buffer = [0u8; 4];
file.read_exact(&mut buffer)?;
u32::from_le_bytes(buffer)
#

whats wrong with this

#

looks a lot cleaner than c

FILE* f = fopen("ur file", "rb");
unsigned char buf[4];
fread(buf, 1, 4, f);
uint32_t x = *(uint32_t*)buf;
spark tiger
#

or the next four bytes

spark tiger
#

afaik there's no easy safe way of doing so in rust

spark tiger
#

oh

#

that's p good then

#

that looks good if it's fast enough

hoary sluice
#

or maybe @valid jetty knows better sol

fleet cedar
#

?crate bytemuck

#

Wait that bot isn't here

hoary sluice
#

gn

spark tiger
spark tiger
#

whyyy :(

valid jetty
#

@hoary sluice @placid cape

placid cape
#

gj

#

i just finished my powerpoint presentation lol

#

i hate office so much

spark tiger
fleet cedar
#

Ew, unwrap

ornate quiver
spark tiger
ornate quiver
#

yeah dunno then

ornate quiver
#

like the scroll crate

spark tiger
#

but if there's really no easy way, then i guess i'll just stick with what works

ornate quiver
#

up to you
generally people hesitate less to use crates because the build & dependency system is amazing unlike pip

spark tiger
#

true

#

opening an average rust project i would see much more dependencies than i would see in python

frosty obsidian
valid jetty
#

lmao

viscid grove
#

why comment it instead of deleting it?

frosty obsidian
#

its faster

dawn ledge
#
fn read<S, T>(stream: S) -> T
where
  S: io::Read,
  T: Readable
{
  let mut buf = [0; T::SIZE];
  stream.read(&mut buf);
  T::from_buf(buf)
}

trait Readable {
  const SIZE: usize;
  fn from_buf(buf: [u8; Self::SIZE]) -> Self;
}

macro_rules! impl_readable_int {
  ($($int:ty: $func:expr),+) => {
    $(
    impl Readable for $int {
      const SIZE: usize = core::mem::size_of::<$int>();
      fn from_buf(buf: [u8; Self::SIZE]) -> Self {
        $func(buf)
      }
    }
    )+
  }
}

impl_readable_int!(
  i8: i8::from_le_bytes,
  i16: i16::from_le_bytes,
  i64: i64::from_le_bytes,
  i128: i128::from_le_bytes,
  isize: isize::from_le_bytes,
  u8: u8::from_le_bytes,
  u16: u16::from_le_bytes,
  u64: u64::from_le_bytes,
  u128: u128::from_le_bytes,
  usize: usize::from_le_bytes
)
#

you can probably change it to account for endianness

#

probably

fn read_le<S, T>(stream: S) -> T /* ... */ {
  // ...
  T::from_buf_le(buf)
}

fn read_be<S, T>(stream: S) -> T /* ... */ {
  // ...
  T::from_buf_be(buf)
}

trait Readable {
  // ...
  fn from_buf_le(buf: [u8; Self::SIZE]) -> Self;
  fn from_buf_be(buf: [u8; Self::SIZE]) -> Self;
}
dawn ledge
jade stone
#

i feel like this is the must cursed js ive ever written

#
class a{
    private DynamicNode = (() => {
        const provider = this;
        return class DynamicNode implements IDynamicNode {
            lastNode: Item | null = null;
            constructor(private readonly _getNode: (reRender: () => void, lastNode: Item | null) => Item) {
            }
            getNode(): Item {
                return (this.lastNode = this._getNode(() => provider._onDidChangeTreeData.fire(this), this.lastNode));
            }
        };
    })();
}```
serene elk
jade stone
#

i dont want to write a custom webview

serene elk
#

why is it inside a class tho

jade stone
#

because it has to be

serene elk
#

a class inside a class

jade stone
#

the vscode api calls the constructor

hoary sluice
#

in a modern company there would be 18 meetings held and 3 sprints planned for this

jade stone
#

@serene elk i use it like this

class a{  
private makeDepSettings(): Section {
    return new Section("Dependency Cache Settings", [
      new this.DynamicNode(reRender =>
        ModuleDepManager.hasModDeps()
          ? new Text("Module Dependencies Loaded")
          : new Button("Load Module Dependencies", async () => {
              ModuleDepManager.initModDeps({ fromDisk: true }).then(() =>
                reRender()
              );
            })
      ),
    ]);
  }
}
hoary sluice
serene elk
jade stone
#

it needs to be a class because otherwise you would have to re-render the parent of the element you wanted to re-render

serene elk
#

why can't dynamic node be outside

jade stone
serene elk
#

DynamicNode definition outside class a

jade stone
#

because to re-render you need a field of the class

serene elk
#

you can't edit the constructor to pass the provider as a prop?

jade stone
#

i could prob throw it outside and do some proxy fuckery, but cant be bothered

hoary sluice
#

rosie waking up an human times???

#

@valid jetty how to make runtime resolved precedence

valid jetty
fleet cedar
valid jetty
valid jetty
#

like a language called noulith does

fleet cedar
#

Usually at parse time, but it depends on how flexible your operator overloading and custom operators are

fleet cedar
#

How does that work

hoary sluice
#

im probably gonna implement it at parse time and then try to do it later once i have reflection or smth

hoary sluice
#

noulith does it

#

there are builtin functions to change it at runtime

#

i might look at his src

valid jetty
#

it’s actually the most painful thing ever

#

@hoary sluice you could probably do something like

(expr1) + (expr2) * (expr3) parses into precedence_resolve((expr1), “+”, (expr2), “*”, (expr3)) and then resolve it like that

hoary sluice
hoary sluice
#

to someone who has been learning c for 2 years

hoary sluice
valid jetty
#

it’s not exactly recursive descent it’s a custom algorithm

#

it would work well for the thing i showed i think

valid jetty
#

btw i got the garbage collector to work idk if i mentioned lmao

#

its not fast at all

#

because objects are exactly sized buffers and its a linked list

#

but it did day 12 with minimal memory usage (only a few mbs avg) and then finished with no leaks

#

im planning to make 1 big contigious growing and shrinking buffer and then make allocations go into that

#

then the pointer is stored in a hashmap for fast lookup

#

and ideally with a free list and free blocks are merged at the time of collection

#

i have about 5 hours until my lessons start today so ill see if i can do that

calm ruin
#

elle garbage collector creates more garbage than it cleans

valid jetty
#

thats true actually it fails to clear some of the garbage atm

#

some pointers to the stack are still marked even after the function ends

#

weirdly enough

hoary sluice
calm ruin
hoary sluice
calm ruin
#

Kotlin native is horrible

#

Not even you used it in aoc

placid cape
hoary sluice
#

@valid jetty should carriage returns be illegal

#

in my lexer

#

theyre useless annoying and deprecated

fleet cedar
#

On one hand yes

#

On the other hand windows users would hate you

#

I'd make it so if the cr is followed by lf it is ignored, if it's not it's an error

hoary sluice
hoary sluice
#

@valid jetty do u use f128

#

or f64

#

cause its unstable apparently

#

but idk if it actually affects native x86

valid jetty
#

i dont use either

#

floats are a div instruction of 2 i128

hoary sluice
#

wtf

fleet cedar
#

So your "floats" are 256 bits?

pearl stagBOT
# valid jetty https://github.com/acquitelol/elle/blob/rewrite/src/parser/statement.rs#L262-L29...

statement.rs: Lines 262-295

fn parse_float(&self, token: Token) -> AstNode {
    let value = match token.value {
        ValueKind::String(val) => val,
        _ => todo!(),
    };

    if !value.contains(".") {
        panic!("Invalid float literal provided");
    }

    let nodes: Vec<&str> = value.split('.').collect();
    let left = nodes[0];
    let right = nodes[1];

    let exponent = right.len();
    let original = String::from_iter([left, right]).parse::<i128>().unwrap();

    AstNode::BinaryOperation {
        left: Box::new(AstNode::Literal {
            kind: TokenKind::FloatLiteral,
            value: ValueKind::Number(original),
            location: self.current_token().location,
        }),
        right: Box::new(AstNode::Literal {
            kind: TokenKind::FloatLiteral,
            value: ValueKind::Number(10_i128.pow(exponent as u32)),
            location: self.current_token().location,
        }),
        operator: TokenKind::Divide,
        treat_as_string: false,
        dunder_methods: true,
        location: self.current_token().location,
    }
}
hoary sluice
#

isnt that slower at runtime

valid jetty
#

i dont think so

hoary sluice
#

cause ur dividing instead of storing a constant float

valid jetty
#

optimization does constant folding

hoary sluice
#

hm ok

valid jetty
#
export function w $main() {
@start
    %x =d div d_1, d_10
    call $printf(d %x)
    ret 0
}

data $fmt = { b "%f", b 0 }
#
.text
.balign 4
.globl _main
_main:
    hint    #34
    stp    x29, x30, [sp, -16]!
    mov    x29, sp
    adrp    x0, "Lfp0"@page
    add    x0, x0, "Lfp0"@pageoff
    ldr    d0, [x0]
    bl    _printf
    mov    w0, #0
    ldp    x29, x30, [sp], 16
    ret
/* end function main */

.data
.balign 8
_fmt:
    .ascii "%f"
    .byte 0
/* end data */

/* floating point constants */
.section __TEXT,__literal8,8byte_literals
.p2align 3
Lfp0:
    .int -1717986918
    .int 1069128089 /* 0.100000 */
#

stores 0.1 directly

#

shrug

jade stone
#

thanks vscode, i really need to download all of these

dense sand
#

how does regex in JS works? why am i getting no matches in JS?

#

this is how i have it defined:

export const methodDefRegex = /(?<modifiers>.+) (?<return>\S+) (?<name>\S+)\((?<params>).*\)/gm;
placid cape
#

should i use kotlin multiplatform for mobile app or flutter?

dense sand
#

id give a shot to flutter given your app doesnt really need to be multiplatform

placid cape
#

except the params stuff

placid cape
#

just store floats as floats

#

rosie just didnt know that you can do stored d_5.4

dense sand
placid cape
#

what string?

#

you can get captured groups

dense sand
#

the input one

placid cape
#

yes just do .input ?

dense sand
#

no from the input

#

lets just say

const input = "static void idk()"
// Get input as array of ascii codes?
still jolt
#

you could do [...input].map(ch => ch.charCodeAt(0))

dense sand
#

right

#

as i suspceted it contained some random utf codes

dense sand
#

like they work inside regex101

dense sand
dense sand
hoary sluice
#

im lexing floats now

fleet cedar
#

Are you flexing loats?

hoary sluice
#

yes

#

flexing lats

#

@valid jetty @placid cape do i write voice assistant nlp in rust

#

it needs to run fast on embedded

fleet cedar
#

Write voice assistant in brainfuck

hoary sluice
#

so true

placid cape
#

what do you want to use for speech to text?

still jolt
placid cape
# hoary sluice what

Rosie didn't know that you can directly use floats in QBE without making division

#

you just have to prefix them with d_/s_

#

.

#

sorry for ping

placid cape
#

wuhuuu

#

i know it still doesnt work correctly

#

xd

dense sand
#

does someone know why am i getting overful hbox here?

fleet cedar
placid cape
#

Like in zig

#

There's also implicit casting but this one is explicit

valid jetty
#

imo that syntax is better than C style or as foo

#

because there is never any ambiguity

#

im planning to change my C style (T)x cast to #cast(T, x) because its just a lot easier to parse lol

#

parsing a cast to a tuple type (as in finding whether its a cast or an expr wrapped in parens) is also literally impossible to do effectively with C style cast so theres that

fleet cedar
#

Works poorly if types and expressions have different syntax though

#

Better to have cast<i32>(val) imo

valid jetty
#

imo that should be reserved for casting a primitive to a different kind of primitive

#

like string to i32

#

or you can do the C++ and have a billion kinds of casts

#

mmmmmmmmm im gonna reinterpret pun dynamic const safe cast my variable

#

technically i can do that actually

#

just consitutes of a little generic trickery

#

U is inferred from args so you only need to pass T

frosty obsidian
#

as?

valid jetty
#

does kotlin have transmute

frosty obsidian
#

idk what that is

valid jetty
#

lc.define transmute

visual shellBOT
# valid jetty lc.define transmute

<:i:1263592450136473684> transmute  trɑːnzˈmjuːt 

verb

  1. change in form, nature, or substance.
  • the raw material of his experience was transmuted into stories
    <:i:1263591098740113478>  transmogrify 
valid jetty
#

uh

#

kinda

deep mulch
#

wing detected

frosty obsidian
#

there are a ton of type conversion functions

valid jetty
#

its like

deep mulch
valid jetty
#

as an example

frosty obsidian
#

lc.g transmute programming

visual shellBOT
deep mulch
frosty obsidian
#

we don't have structs for instance

valid jetty
#

oh

deep mulch
#

well i mean you can just have a function transute()

#

copies over the values to the new class

frosty obsidian
#

you can manually convert stuff yeah

deep mulch
#

@frosty obsidian

valid jetty
#

somewhat

deep mulch
#

oh

valid jetty
#

the 4 1-byte char struct is 32 bits in contiguous memory which is why you can transmute it to a 32 bit int

deep mulch
#

yea kotler cant do that

#

too high level

frosty obsidian
#

not low level enough

deep mulch
#

could maybe be implemented using JNI

frosty obsidian
#

well yeah but you aren't in kotlin at that point

deep mulch
#

like

#

making function that kotlin can call then C++ does the transmuting and returns the object back to kotlin

#

might work