#πŸͺ…-progaming

1 messages Β· Page 59 of 1

placid cape
#

use tailwind

median root
#

sober has no aarch64 build sad

hoary sluice
#

doesnt bedrock work natively on linux

placid cape
#

it doesnt

jade stone
placid cape
#

because the app uses UWP on windwos

#

and they're stupid

jade stone
placid cape
#

they use UWP to avoid cracking on computer but you can still crack it pretty easily

leaden crater
#

@valid jetty I'll try table later, for now I'm stuck with dd iso inside a dd iso and deserted instructions

valid jetty
valid jetty
#

i have my own abstraction for styles

hoary sluice
#

of course you do

leaden crater
#

dd if=mint.iso of=/dev/sda whilst dev sda has arch iso

#

very not fun to happen

valid jetty
#
const { merge, styles } = createStyleSheet({
    container: {
        display: 'flex',
        alignItems: 'center',
        justifyContent: 'center'
    },

    button: {
        marginBottom: '4em',
        padding: '2em'
    }
});

export function MyComponent() {
    return <div style={styles.container}>
        <button style={merge(s => [s.button, { color: '#EEE' })}>Button 1</button>
        <button style={merge(s => [s.button, { color: '#DDD' })}>Button 2</button>
        <button style={merge(s => [s.button, { color: '#CCC' })}>Button 2</button>
    </div>;
}
#

this

hoary sluice
#

were you booted into the arch so

#

iso

valid jetty
#

its extremely simple but so powerful

type StyleSheet = Record<string, React.CSSProperties>;

export const mergeStyles = (...styles: React.CSSProperties[]) => styles.reduce((pre, cur) => ({ ...pre, ...cur }), {});
export const createStyleSheet = <T extends StyleSheet>(sheet: T) => ({
    styles: sheet,
    merge: (callback: (sheet: T) => React.CSSProperties[]) => mergeStyles(...callback(sheet))
});
#

and the styles are typed and eveything

lavish frigate
#

are you using react for this...

leaden crater
valid jetty
#

yes because im the most comfortable with it

lavish frigate
#

😭 😭 😭 😭 😭

valid jetty
#

this has some complicated state

hoary sluice
#

also doesnt the arch iso have gparted

#

pretty sure it does

leaden crater
leaden crater
hoary sluice
#

why not use fdisk

leaden crater
#

gparted is more safe

#

I'm gonna lose it if i lose my windows install

#

i stayed like 40 mins to fix mirrors anyways

#

the iso was pretty much fucked and i didn't want to download again

valid jetty
# lavish frigate 😭 😭 😭 😭 😭
  • when width and height change, the matrix is resized but it keeps all the existing values in it
  • when editing the matrix, values go into a seperate scratch matrix which overrides the actual matrix when you exit edit mode
  • when you perform an iteration of the algorithm, the previous state of the matrix is stored in a set so you can undo the operation
  • all of that is statefully and automatically synced with localStorage via a hook i wrote, and it acts exactly like normal state
  • its passed through context too, to all the components that need each piece

its pretty complicated lol

#

im sure i could do that with something like svelte

#

and i was tempted

#

but i dont have time

lavish frigate
#

i wasnt suggesting svelte 😭

placid cape
#

jquery

valid jetty
#

i have no idea how i would do this in another framework lmao

import { useState, useLayoutEffect } from "react";

export const useStorageValue = <T>(
  key: string,
  cb: (x: string) => T,
  def: string | null = null,
  formatter?: (x: T) => string,
) => {
  const [value, setValue] = useState<T>(cb(localStorage.getItem(key) ?? def!));

  useLayoutEffect(() => {
    localStorage.setItem(key, (formatter ?? String)(value));
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, [value]);

  return [value, setValue] as const;
};

const rows = useStorageValue("rows", Number, "4");
const cols = useStorageValue("cols", Number, "10");

const oldRows = useStorageValue("rows", Number, "4");
const oldCols = useStorageValue("cols", Number, "10");

const editing = useState(false);

const matrix = useStorageValue<number[][]>(
  "matrix",
  JSON.parse,
  "[]",
  JSON.stringify,
);

const scratchMatrix = useStorageValue<number[][]>(
  "matrix",
  JSON.parse,
  "[]",
  JSON.stringify,
);

const prevStates = useStorageValue<Set<number[][]>>(
  "prevStates",
  (x) => new Set(JSON.parse(x) as number[][][]),
  "[]",
  (x) => JSON.stringify(Array.from(x)),
);
lavish frigate
#

i mostly asked cuz i dont really see how react makes it so much easier i wouldve suggested vanilla since we arent in 2006 anymore and vanilla is powerful enough

hoary sluice
#

why not use dioxus

lavish frigate
#

πŸ”₯

lavish frigate
valid jetty
hoary sluice
#

why not use dioxus

placid cape
#

nanostores

lavish frigate
#

cuz its 1 page

placid cape
lavish frigate
#

and i dont need components

#

or anything like that

lavish frigate
placid cape
#

astro πŸ”₯

valid jetty
#

for the record this deploys a single react file lol

lavish frigate
#

i dont need 50 files on my system all used to create one file either

valid jetty
#

its 188kb ungzipped

lavish frigate
#

who the hell thought of all this garbage?

valid jetty
#

which is high but whatever

lavish frigate
#

i love that rsbuild has an x on the icon (it works perfectly fine)

#

i despise the current js ecosystem is so much everything for nothing

valid jetty
#

yeah i agree with that

#

thats a lot of files

#

i was gonna try something new but the simplex tableau is a complicated thing

#

if i got it wrong it wouldve been hell to debug, and it was already hell enough to debug the state even in react

#

i might rewrite it

hoary sluice
#

you tried making a really hard aoc and instead made a really easy typing speed test

formal belfry
valid jetty
#

maybe i got it to work

valid jetty
#

i finished a hobby project in a day thats a record for me

hoary sluice
valid jetty
#

otherwise 3 days if you count the lexer too

valid jetty
# hoary sluice what is this evil magic

Linear programming is a technique for finding the minimum (or maximum) of a linear function of a set of continuous variables subject to linear equality and inequality constraints.

hoary sluice
#

we should configure nvim together

valid jetty
hoary sluice
#

nvchad isnt perfect

valid jetty
#

works well enough and i still use zed mostly anyway xd

hoary sluice
valid jetty
#

only time i use nvim is when im sshed into my thinkpad

valid jetty
#

imagine you have a company

#

the company makes like.. paints A and B

hoary sluice
#

what's a paint

valid jetty
#

to make paint A you need 35 of ingredient X and 42 of ingredient Y and it makes you $25

#

to make paint B you need 38 of ingredient X and 33 of ingredient Y and it makes $22

#

you have like 2000 of X and 1500 of Y

#

how much paint do you make of each kind such that you maximize your profit

hoary sluice
#

aoc claw machine problem

valid jetty
#

its basically that but on a larger scale (3+ constraints)

#

at which point you cant graphically solve it by intersection anymore

hoary sluice
#

can i have unlimited constraints

valid jetty
valid jetty
#

to extend it to as many constraints as needed

hoary sluice
valid jetty
#

i mean yeah but not really because theyre inequalities not equations

#

they become equations when you introduce slack variables

#

but then you have more variables than equations so you cant solve them like systems of equations

valid jetty
hoary sluice
#

i mean aoc was you have product A and product B, getting A takes a x steps and b y steps and getting b takes c x steps and d y steps

#

right

#

isnt that the same

valid jetty
#

yeah but that was solveable directly

hoary sluice
valid jetty
#

try to like see how the inequalities map to the tableau

#

i recommend watching a video about this if you really wanna learn

#

its hard to explain without going into a lott of detail

hoary sluice
#

this looks useful for aoc

valid jetty
#

i mean it might be

#

but its a bit evil to get a question on this

hoary sluice
#

theres usually multiples solutions for aoc problems

valid jetty
#

this is essentially my solver impl

export function pivot(
  matrix: number[][],
  row: number,
  col: number,
  rows: number,
) {
  const newMatrix = matrix.map((row) => [...row]);
  const p = newMatrix[row][col];
  newMatrix[row] = newMatrix[row].map((val) => val / p);

  for (let i = 0; i < rows; ++i) {
    if (i === row) continue;

    const m = newMatrix[i][col];
    newMatrix[i] = newMatrix[i].map((val, j) => val - newMatrix[row][j] * m);
  }

  return newMatrix;
}

export function autoPivot(matrix: number[][], rows: number, cols: number) {
  // Ignore the RHS row when finding the pivot column
  const c = matrix[0].findIndex(
    (x) => x === Math.min(...matrix[0].slice(0, matrix[0].length - 1)),
  );

  if (c === -1) return;

  // Find the row with the smallest ratio
  const ratios = matrix.slice(1).map((x, i) => {
    const pivot = x[c];
    return pivot > 0 ? matrix[i + 1][cols - 1] / pivot : Infinity;
  });

  const r = ratios.findIndex((x) => x === Math.min(...ratios));
  if (r === -1) return;

  return pivot(matrix, r + 1, c, rows);
}

export const isOptimal = (matrix: number[][]) =>
  matrix[0].slice(0, matrix[0].length - 1).every((x) => x >= 0);
const solve = () => {
  const solvePrevStates: number[][][] = [...prevStates];
  let solveMatrix = matrix.map((row) => [...row]);

  while (!isOptimal(solveMatrix)) {
    const matrix = autoPivot(solveMatrix, rows, cols);
    if (!matrix) break;

    solvePrevStates.push(solveMatrix);
    solveMatrix = matrix;
  }

  setPrevStates(setWithDedupe(solvePrevStates, deepEqual));
  setMatrix(solveMatrix);
};
#

its not that big but probably too big to write in the middle of an aoc

#

especially considering you have to actually create the tableau

valid jetty
#

i guess lol

#

i wouldnt recommend just refactoring into kt and putting into a lib tho

#

it wont be helpful at all if you dont know how to use it, like you wont even catch the cases where you "could" use it

hoary sluice
#
return LP().solve("M = m - 5").ineq("m <= 9p2 + 6p3 + 11p4").ineq(/* etc */)
hoary sluice
valid jetty
hoary sluice
#

i only have to write the parser once

valid jetty
#

ACTUALLY

valid jetty
hoary sluice
#

how are you pulling random articles you wrote out of your ass

hoary sluice
#

is power rule

f = x^2
f' = 2x
valid jetty
#

yes

#

but it only works if the power is a constant and the base is the variable you’re differentiating with respect to

#

otherwise you have to use chain rule or something

hoary sluice
#

i didnt know they had names i thought u kinda just did that

valid jetty
#

lol nope there’s like 5

#

constant rule, power rule, product rule, quotient rule, chain rule

solar thistle
#

typical low-level developer

hoary sluice
leaden crater
solar thistle
#

time to get murdered by grammar police

valid jetty
hazy pine
#

i thought this was pro gaming not math :(

hoary sluice
#

i think we learned that and i frgoro

valid jetty
#

d/dx[f(x) / g(x)] = ((f’x)(g(x) - (f(x))(g’x))/(g^2(x))

valid jetty
#

chain rule is d/dx[f(g(x))] = f’(g(x)) * g’x

leaden crater
solar thistle
valid jetty
hoary sluice
valid jetty
#

oh true

leaden crater
hoary sluice
#

and the 2nd derivative of time is also 0 and integrating with respect to 0

leaden crater
#

In mathematics and applied mathematics, perturbation theory comprises methods for finding an approximate solution to a problem, by starting from the exact solution of a related, simpler problem. A critical feature of the technique is a middle step that breaks the problem into "solvable" and "perturbative" parts. In regular perturbation theory, ...

solar thistle
#

stop being big brain guys my dumbahh can't comprehend

leaden crater
hoary sluice
#

thats the 2nd derivative of position wrt time

#

d''x/dt''

#

d''t/dt'' is 0

#

unless youre in a black hole or something stupid like that

#

where time is like a polynomial or smth

leaden crater
#

7 dimensional time

hoary sluice
#

cause we need d''

leaden crater
#

12 dimensional everything

hoary sluice
#

have fun integrating with respect to 0

#

@valid jetty whats the 7th derivative of x with respect to 0

leaden crater
#

have fun not integrating

#

i like to math

hoary sluice
median root
#

alr lets play my fav game, where are the 42 errors in my code comming from after restarting my lsp?

median root
hoary sluice
#

(ur the cat)

#

(stop programming so much and work out)

valid jetty
#

WHAT

#

evil,,

hoary sluice
supple whale
valid jetty
#

nice start to april i guess

#

its not gonna last tho because i have about a month until my end of year exams so i have to focus on those instead

#

ive been recommended to do 6 hours of revision a day every day for the next month

lavish frigate
dense sand
#

Should i switch from make to meson/cmake

dense sand
#

@supple whale do you have somewhere the args i should use when compiling with emcc

dense sand
#

i thought that 1024kib would be enough to run java program 😭

fleet cedar
#

Lol, you think 1mb is enough for anything?

dense sand
#

πŸ’€

#

well the heap filled up instantly, but i didnt run gc

fleet cedar
#

Have fun with that

hoary sluice
#

how did i not know abt this

simple sapphire
valid jetty
#

jump to the nearest β€œ, clear everything until the next β€œ, and enter insert mode

hoary sluice
#

this is trivial

dense sand
#

im thinking if i should rewrite my heap again and instead of having preallocated block i should just use the platform's malloc implementation

#

any tips on deciding on this?

valid jetty
#

@leaden crater @hoary sluice YOU RUINED IT I HAVE ROMANIAN ON MY γŠγ™γ™γ‚ NOW

leaden crater
dense sand
#

what's wrong with my gpt 😭

fleet cedar
#

Yeah gpt sometimes grows an attitude

#

Much more fun than its default "personality"

lavish frigate
#

exposing yourselves as ai loving vibe coders...

valid jetty
dense sand
lavish frigate
#

mhm

#

leak entire chatgpt history NOW!

valid jetty
#

yeah i do that too sometimes

dense sand
#

so like

#

i could

valid jetty
#

however isnt that just a modern version of the coding duck lol

valid jetty
#

i use my plushies instead for that purpose

dense sand
#

i was actually thinking of making a big 3d printed duck with rpi and speaker inside wired to openai api

lavish frigate
#

we shouldve trained chatgpt on stackoverflow correctly

dense sand
lavish frigate
valid jetty
fleet cedar
#

Search engine and copyright violation engine

nimble bone
#

@valid jetty is a vibe coder

lavish frigate
valid jetty
#

LMAO

nimble bone
#

nop im stupit

valid jetty
#

im trying to find ANYONE who knows what this even is

#

the only people who know are people who do further maths at my school

#

!!! (its so pointless)

dense sand
#

i fucking hate vibe coders, in our class we had to write a test to try out tdd and then exchange it with other group to write the implementations. we received gpt generated code which didnt even compile mainly because they were passing strings to enums everywhere for some reason

#

when i confronted them about it they were like "well its not our problem, you have to work with it"

#

like man with this attitude you wont be getting paid for this

#

i ended up just rewriting everything from the ground up

valid jetty
#

people who vibe code are like

#

developed ipad kids

#

ipad kids who grew up

#

@nimble bone i have banana milk πŸ˜‹ πŸ˜‹ πŸ˜‹ πŸ˜‹

nimble bone
#

how

#

give

valid jetty
#

nooo

#

mine

#

:3

leaden crater
#

@valid jetty

valid jetty
#

hiii

leaden crater
#

hiiii

#

can you help me with a problem i saw, i tried both calcualtor, photomath, wolfram and ||ai|| and none got it right

#

maybe im stupid and there doesnt exist a solution at all

#

the logs arent multiplied so i think its impossible

valid jetty
#

what is your goal

#

a simplification or a decimal approximation

leaden crater
#

simplification

deep mulch
#

@valid jetty are you a vibe coder

#

@valid jetty code a procedural tree generator with elle

fleet cedar
#

Be a procedural tree generator

#

||Also known as a gardener||

dense sand
#

In real world, no tree is binary

valid jetty
#

@deep mulch ```py
def parity(n):
return "eovdedn"[n % 2 :: 2];

odd even

print(parity(5), parity(8))

deep mulch
#

add js-like type coercion @valid jetty

wispy kernel
leaden crater
#

@deep mulch

IDENTIFICATION DIVISION.
PROGRAM-ID. COLLATZ.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUM PIC 9(10).
01 TEMP PIC 9(10).
PROCEDURE DIVISION.
MAIN-LOGIC.
    DISPLAY "ENTER A NUMBER: "
    ACCEPT NUM
    PERFORM UNTIL NUM = 1
        DIVIDE NUM BY 2 GIVING TEMP REMAINDER TEMP
        IF TEMP = 0
            COMPUTE NUM = NUM / 2
        ELSE
            COMPUTE NUM = NUM * 3 + 1
        END-IF
        DISPLAY NUM
    END-PERFORM
    STOP RUN.
    
leaden crater
deep mulch
#

I love Fortran

leaden crater
#

its not fortan

deep mulch
#

oh

#

cobol

leaden crater
#

catbol

deep mulch
#

or forth

#

@leaden crater

leaden crater
shrewd canopy
lavish frigate
hazy pine
#

is that unico

runic sundial
#

@royal nymph

hazy pine
#

vencord rust rewrite when

ionic lake
#

today

mellow phoenix
supple whale
#

wait actually, does is the new discord game integration available to every1?

#

cant u just use it to make a fake game, and ur own simple discord client, in rust?

shrewd canopy
shrewd canopy
#

however its oauth2 and has pretty limited functionality

supple whale
#

@hazy pine welp, vencord rust time!!!!

supple whale
#

and thats it?

hazy pine
#

theres alot of 3rd party client we'll be finee

#

what if we just make vesktop but with tauri, would that be rust enough

supple whale
shrewd canopy
shrewd canopy
supple whale
#

ay, thats quite a lot

hazy pine
#

is it really a problem

supple whale
shrewd canopy
#

if you send an appeal and explicitly say you used third party client then you'll unbanned

supple whale
#

yeah i think the game integration thing is x100 safer

fleet cedar
supple whale
#

and easier

shrewd canopy
winged mantle
#

I made a cursed solution for logger lazy evaluation

#

(if level is hidden ?. returns undefined)

#

(also allows checking whether level is shown with if (logger.info)

royal nymph
#

lmao

supple whale
#

and not have the extra markup?

winged mantle
#

it's so that it only evaluates the message expression if the level is enabled

#

in case you call a really expensive function for some reason

#

before i had it execute the message if it was a function

#

but i realised that would be an ideal weak point for rce blobcatcozy

winged mantle
#

looks good at least

supple whale
#

ah yes escape codes

#

i fucking hate it

#

i recommend the debug package if u want to find more codes and how to find which are supported

#

but it makes my blood boil, because while its nice in console, when logged to a text file its fucking awul

winged mantle
#

I think i will implement logging to file separately

supple whale
#

i log all my console messages to a logs.txt file, and opening that makes it awful

winged mantle
#

which will be fun

#

maybe i can also detect if escape codes are supported

supple whale
#

i did it via console, because its legit just piping stdio into a file

#

so its so laughably easy its crazy

winged mantle
#

but i don't think piping into a file works with stderr anyway

supple whale
#

cant beat chalk for it

#

:^)

winged mantle
#

if i'm actually being sensible and using libs i might as well find a logger lib

#

although none of them looked like much fun to me for some reason

supple whale
#

by far the BEST logging lib i used

#

but it has issues when you use electron logger

#

since you cant easily just disable or change colors for browser

winged mantle
#

thanks but i think i'll see how painful it is to write to file first

#

you'd probably want it to archive the file every time it's midnight and gzip it

supple whale
#

node/deno?

winged mantle
#

node

#

i have not gzipped a file before

supple whale
#

that lets u enable/disable different debugs

winged mantle
#

i saw it supports multiple streams in a quick skim

supple whale
#

so u can do DEBUG=chat:* and it debugs for example chat:message chat:event

winged mantle
#

kinda useful

supple whale
#

ya do

import Debug from 'debug'

const debug = Debug('chat:message')

debug('emitted message: %s', message)
winged mantle
#

my solution was just to try not to litter the log with too many messages

supple whale
#

and it just outputs to console.log

#

and then you pipe console.log aka stdio to a file yourself

#

which is piss, like 4 LOC

#
import { createWriteStream } from 'node:fs'

process.stdout.pipe(createWriteStream('/log.txt', { flags: 'a' }))
winged mantle
#

i heard that console.log is blocking

#

is this true

supple whale
#

well yes ofc

#

its a sync function

winged mantle
#

but does it wait for the syscall 😭

supple whale
#

no, its a stream

winged mantle
#

yeah that would be weird

supple whale
#

the initial console.log call is sync

#

but then its passed to a stream, which is event loop based

winged mantle
#

i assume it uses a buffer

supple whale
#

from what i understand

winged mantle
#

but i would've thought the actual syscall would be on another thread

supple whale
#

no, its on "the same thread"

#

or the same process

#

its kinda weird with how nodejs does native bindings

#

because its the same thread, but its async from the v8 vm itself...

#

and its fucky

#

the less you know the better for your sanity

winged mantle
#

sounds about right

dense sand
#

What the hell is there even a good auth library in js?

#

Better auth works not works

#

Authjs just sucks

#

I dont want to switch to supabase duh

#

Do i just roll my own auth

hoary sluice
dense sand
#

I need something compatible with nextjs

#

If i were to use other lang for backend id just use java

hoary sluice
dense sand
hoary sluice
dense sand
leaden crater
fleet cedar
#

Assassinate them

runic sundial
#

fucking love llvm

#

i love having to work around

#

CACHING

#

and CONSTANT FOLDING

lavish frigate
#

large language... v... machine-learning (ai)

runic sundial
#

I've had 2 memory related issues with C++ thus far, most of what's fucked with this demented language is how people are like

#

"DAMN BRO, BUT WHAT IF WE MADE IT FASTER?????"

#

Shit lang where I guess it's common practice to optimize for the sake of optimization

#

But now my tests are passing again

fleet cedar
runic sundial
#

ub?

#

@fleet cedar what the hell is ub

fleet cedar
#

Undefined behavior

runic sundial
#

in what way?

fleet cedar
#

InBoundsGEP requires the offset to be in bounds

runic sundial
#

Well it is, it is in bounds once it reaches the verifier

#

but it actually doesn't seem to give a shit if it's the first index that's out of whack

#

It's the ones after that where it actually validates, since it would need to calc the machine offset

#

Either way. The pain here is that I'm re-mapping GEP offsets.

#

And this fucker has been giving me a bad time

#

Where it will gleefully alias instances of GEPOperator

sage smelt
#

how do i make a plugin click on a message's button using the button's customid? ThinkingHmm

leaden crater
sage smelt
hollow patio
#

How evil can you possibly be
Me:

shrewd canopy
#

i love

#

(i want zod but for python)

balmy lintel
winged mantle
#

why does thei nvite endpoint for bots only show friend invites if you remove the bot prefix of the token

supple whale
#

i rly need to get better at using abortsignal

#

esp for like destroying classes and shit

winged mantle
#

javascript destructor when

fleet cedar
#

I've never seen a GC language with proper dtors

winged mantle
#

hiddenphox uses fetch manually

#

hf!inviteinfo aABKp5XD

pearl stagBOT
winged mantle
#

where is discord staff in this server...

valid jetty
#

this is interesting

#define __DEFER_INTERNAL__(f, v) \
    auto void f(char*); \
    char v __attribute__((__cleanup__(f))); \
    auto void f(char*)
#define __DEFER_WITH_COUNTER__(x) \
    __DEFER_INTERNAL__(__f##x##__, __v##x##__)
#define __DEFER__(N) __DEFER_WITH_COUNTER__(N)
#define defer __DEFER__(__COUNTER__)

int main() {
    int *x = malloc(6 * sizeof(int));
    defer { free(x); };

    return 0;
}
supple whale
#

using

winged mantle
#

uh

supple whale
#

which calls a destrictor when an object exits scope/wants to be GC'ed

winged mantle
#

does it really work like in c#

#

i thought it worked like

#

using(console) { log("h") }

winged mantle
#

and was very discouraged

supple whale
#
class TempFile implements Disposable {
    #path: string;
    #handle: number;
    constructor(path: string) {
        this.#path = path;
        this.#handle = fs.openSync(path, "w+");
    }
    // other methods
    [Symbol.dispose]() {
        // Close the file and delete it.
        fs.closeSync(this.#handle);
        fs.unlinkSync(this.#path);
    }
}
export function doSomeWork() {
    using file = new TempFile(".some_temp_file");
    // use file...
    if (someCondition()) {
        // do some more work...
        return;
    }
}
winged mantle
#

oh

#

is this new

supple whale
#

its not implemented yet

winged mantle
#

ah this is the one

#

kotlin simulator

supple whale
#

wtf is that

winged mantle
#

kotlin inspired

supple whale
#

awful!

supple whale
#

i think it was created before kontil went open source

deep mulch
winged mantle
#

i was just taking a chance to bash kotlin

supple whale
deep mulch
#

no one should write Kotlin code like that

winged mantle
#

nah "i program java how did how did you know" [gigachad gif]

deep mulch
#

with is intended for changing the context of a scope

winged mantle
#

i mean it adds good things to java

#

i just don't like some of the other things

#

the only time i loved kotlin was in a dream

deep mulch
#

kode tode

winged mantle
#

that is completely true

#

iirc

#

i don't remember the dream now

#

but i remember posting about it

deep mulch
#

tode.kode

deep mulch
#

delete

hoary sluice
#

@valid jetty i rizzed up my economic teacher to give me an A if i do checkup on friday

#

im gonna graduate with a perfect gpa now

valid jetty
#

lmao insane

deep mulch
#

@valid jetty hiii

hoary sluice
jade stone
#

guhhhh disjoint unions so insane in typescript

balmy lintel
balmy lintel
leaden crater
#

@valid jetty how hard do you think it would it be to make a mahjong discord bot

valid jetty
#

i should put this in elle

valid jetty
winged mantle
#

do you really need to separately fetch response message with discord api

#

i guess this is why people don't do buttons based on message ID

#

I made a lookup with message id, button id

valid jetty
winged mantle
#

so 1358876721079910431, next_page could retrieve data about the command and then use it to respond

#

i guess uuids is better?

deep mulch
#

@valid jetty later I will add SSTV encoding/decoding to my bot

valid jetty
#

rewrite it in rust

deep mulch
shrewd canopy
leaden crater
winged mantle
shrewd canopy
winged mantle
#

I am responding by creating a message

#

but it should be present
** Only present if type is either CHANNEL_MESSAGE_WITH_SOURCE or UPDATE_MESSAGE.

#

time to monkey patch fetch to work out what oceanic is doing again

supple whale
#

has any1 ever overwrote types in a typescript extended class?

#
class HashSet<T extends {id?: string}> extends Map<string, T> {
  constructor (iterable: Iterable<T> = []) {
    super()
    for (const o of iterable) this.add(o)
  }

  _getId (o: T) {
    return o.id
      ? o.id
      : JSON.stringify(o, Object.keys(o).sort())
  }

  has (o: T): boolean {
    return super.has(this._getId(o))
  }

  add (o: T) {
    super.set(this._getId(o), o)
  }

  delete (o: T): boolean {
    return super.delete(this._getId(o))
  }
}
#

its crying about

lavish frigate
#

Map<string, T> the string is the key type and T the value type
when you are doing has (o: T) for example you are trying to use the value type when it expects the key type, you also dont copy the method parameters correctly

#
class HashSet<T extends {id?: string}> extends Map<string, T> {
  constructor (iterable: Iterable<T> = []) {
    super()
    for (const o of iterable) this.add(o)
  }

  has (key: string): boolean {
    return super.has(this._getId(o))
  }

  ...
}
shrewd canopy
leaden crater
valid jetty
#

wait until you heard about 2nd order pdes

#

❀️

leaden crater
#

pdes?

valid jetty
#

partial differential equations

leaden crater
#

ohhh

valid jetty
#

with partial derivatives

#

have u done this thing yet

leaden crater
#

ordinary differential equations by vladimir i. arnold i believe is a pretty good book for its stuff

valid jetty
#

In geometry, a solid of revolution is a solid figure obtained by rotating a plane figure around some straight line (the axis of revolution), which may not intersect the generatrix (except at its boundary). The surface created by this revolution and which bounds the solid is the surface of revolution.
Assuming that the curve does not cross the ax...

leaden crater
#

tho im more advanced that what is school

valid jetty
#

school is designed for the slowest person

leaden crater
#

i think i learned abt integrals in 6th grade myself

valid jetty
#

integrals in 6th grade????

#

werent you like 11

leaden crater
#

yea from youtube

#

uhhh

valid jetty
#

wtf 😭

leaden crater
#

i was 13 then

#

i still dont know how to solve integrals that are complex

#

i learned abt log, complex numbers + complex plane, derivatives, integrals, lambert w , hyperoperators, transcendental numbers, etc a few years ago,,, but i have to revise it

#

blackpenredpen, 3b1b, vsauce, etc were pretty interesting to watch

#

i did a lot during quarantine but not integrals, my mom said she wouldn't help me because "im too young"

#

now i've been interested in literature recently not much math..

pine prawn
leaden crater
#

asd?

frosty obsidian
#

autistic

pine prawn
#

Autism spectrum disorder

#

Cause what you are describing is a really common symptom :3

leaden crater
#

nop probably im not

pine prawn
frosty obsidian
#

it doesn't

leaden crater
#

my grades at school are stagnating at 50% almost failing anyways, math didnt help

leaden crater
#

only math, english, history is higher than 80%

pine prawn
#

Is (secondary) language stressful or hard for ya?

leaden crater
#

everything is

#

i have so many unfinished things because i really dont know where to start from

pine prawn
pine prawn
leaden crater
#

i was supposed to make project abt smth in german literature, didnt do it for 3 months, only at the deadline and even then from 11pm onwards

leaden crater
#

yea

#

3 languages

pine prawn
#

.. yeah we are clones

leaden crater
#

at least im happy that i got to pass b2 exam

#

i hardly knew anything before hand

pine prawn
#

Do you find busywork difficult?

leaden crater
#

i was typing without thinking and then i passed, i dont think at any essay, i feel like im putting words from a table

leaden crater
pine prawn
#

For me, 30 questions with the same formula is just hell. I just make a program to do it for me after the 3rd question

leaden crater
valid jetty
#

i only started getting interested in that stuff AFTER lockdown

leaden crater
#

if i have to use same thing i just do like

  • // - or Let {thing} be ()1 , {thing} be ()2 etc and use those as replacement
leaden crater
#

:3

#

probably is not there anymore, but it was so boring to watch all useless studies

#

so when we had to go to school i just used the laptop for "work"

pine prawn
leaden crater
#

i used to abbreviate essays

#

same word replaced by ()1 , ()2, etc

#

or sentences

#

etc

#

arrows

pine prawn
#

Oh? So you struggle with long essays?

leaden crater
#

yea but im getting better

#

when i have to write essay for literature i make weird sketches with many arrows and tree-like structures and it just works

pine prawn
#

So you need things structured how you like it?

leaden crater
#

yea

#

i could do an essay on anything if i had the struct

pine prawn
#

Is hand placement awkward?

leaden crater
#

eh?

pine prawn
#

Dino hands?

leaden crater
#

i just write

#

no

pine prawn
#

I mean like in general

leaden crater
#

normal hands..

pine prawn
#

Alrightt

#

Im trying to not sound rude but, id recommend speaking with a professional :D

leaden crater
#

nop

pine prawn
#

Cause to me, it genuinely sounds like you might just have some form of ASD

pine prawn
leaden crater
#

i dont need professionals, if i dont know it it stays like that

#

@pine prawn planes or trains

valid jetty
#

tbh i probably have some form of thing

#

i get hyperfocused on advanced math and computer science but do terribly in stuff like biology and chemistry

#

or like stuff i don’t pick up any of what im taught in school

#

like how i got 9/33 in physics and 30/30 in cs

#

lmao

valid jetty
#

bio and chem were my worst enemy in school

leaden crater
#

i cant get how people learn biology its literally 10000 pages of learning

valid jetty
#

it’s just pure memorization

leaden crater
#

i cant memorize biology..

#

at all

valid jetty
#

lmao yeah

leaden crater
#

for chem currently we have organic chem i told the teacher sorry, cant do it

pine prawn
leaden crater
lavish frigate
pine prawn
valid jetty
#

i pick trains because most of my friends are trains

leaden crater
#

train plane

lavish frigate
valid jetty
pine prawn
lavish frigate
#

WOKE!

pine prawn
valid jetty
#

intuitive knowledge is the best…..

pine prawn
deep mulch
leaden crater
#

i wish sky planes existed and we had to drive out from the atmosphere

valid jetty
#

learning the roots or base of something and then it making sense directly to built upon it and make out more knowledge is the best way to learn

#

cs is literally EXACTLY that and that’s why i love it

deep mulch
#

Rosie is a savant

leaden crater
#

i want to make my own universe

deep mulch
#

@leaden crater let's make one

pine prawn
leaden crater
pine prawn
valid jetty
leaden crater
#

not even with the most complex VR humanity possess, the feeling wont be the same

valid jetty
#

you just fuck around and find out and learn in the process

valid jetty
leaden crater
#

yea

deep mulch
#

@valid jetty program an ASIC

pine prawn
deep mulch
#

or no

#

FPGA

valid jetty
#

like you manually mine out the materials, make the cpu and other parts from scratch, then write your own language and then kernel and then stdlib and then OS

leaden crater
#

a friend of mine works with vhdl so probs possible

deep mulch
#

@valid jetty build a slayer excitor circuit

valid jetty
#

possible but does it exist

leaden crater
#

i will do it

valid jetty
#

do it.

deep mulch
#

@leaden crater is simulated on my pc

valid jetty
#

@deep mulch i’m an ai

deep mulch
pine prawn
leaden crater
#

i dont understand how antique people didnt have the knowledge of today. like...what

valid jetty
deep mulch
#

I force sand to think

leaden crater
#

i want to make my own sword

pine prawn
pine prawn
#

Just dont make a katana

deep mulch
leaden crater
#

machete

pine prawn
leaden crater
#

but probs katana too, i know the process from veritasium

pine prawn
leaden crater
#

and the documentation is public

pine prawn
#

If it can make you cringe after hearing one third of the name, then its good

leaden crater
#

mysword0

pine prawn
#

Should have done mysword0.dat

leaden crater
deep mulch
#

@leaden crater I eat sand

leaden crater
#

sandman

pine prawn
leaden crater
pine prawn
leaden crater
#

Head to http://squarespace.com/forge to save 10% off your first purchase of a website or domain using code FORGE.

Bonus video is on my website here: https://www.asteeleblock.com/bonus

DISCORD: https://discord.gg/7uD2wKyBJD
ALEC'S INSTAGRAM: https://www.instagram.com/alecsteele/
JAMIE'S INSTAGRAM: https://www.instagram.com/jamie.popple/
PATRE...

β–Ά Play video

Head to http://squarespace.com/forge to save 10% off your first purchase of a website or domain using code FORGE.

DISCORD: https://discord.gg/7uD2wKyBJD
ALEC'S INSTAGRAM: https://www.instagram.com/alecsteele/
JAMIE'S INSTAGRAM: https://www.instagram.com/jamie.popple/
PATREON: https://www.patreon.com/alecsteele

My name is Alec Steele. I am a bl...

β–Ά Play video

Head to http://squarespace.com/forge to save 10% off your first purchase of a website or domain using code FORGE.

DISCORD: https://discord.gg/7uD2wKyBJD
ALEC'S INSTAGRAM: https://www.instagram.com/alecsteele/
JAMIE'S INSTAGRAM: https://www.instagram.com/jamie.popple/
PATREON: https://www.patreon.com/alecsteele

My name is Alec Steele. I am a bl...

β–Ά Play video
#

yup

#

best metal

#

i really want to show people what i watch on youtube but most of them never actually care for my videos

#

despite putting a lot of effort in searching in history for it

pine prawn
leaden crater
#

really?

pine prawn
#

Seems like it

#

Labcoatzz?

leaden crater
#

didnt know abt that chanel

pine prawn
#

Plasma channel?

leaden crater
#

plasma?

pine prawn
leaden crater
#

im insane

pine prawn
pine prawn
leaden crater
#

no

#

cabview

pine prawn
#

Sounds relaxing

#

Might check that out

leaden crater
#

i also watched demo ranch until a few days ago

pine prawn
#

Heres a less serious and not irl suggestion: GrayStillPlays

#

Also have you watched nilered?

leaden crater
pine prawn
#

Though im gonna sleep now

#

Gn!

leaden crater
#

theres also integza

#

gn

pine prawn
valid jetty
#

@hoary sluice @deep mulch is it a good idea to get rid of this feature

use std/io;

fn deref(i32 *`ptr`) @manual -> i32 {
    `%res =w loadsw %ptr`;
    `ret %res`;
}

fn add_one(i8 `val`) @manual -> i8 {
    `%res =w add %val, 1`;
    `ret %res`;
}

fn `identity`(i32 `val`) @manual -> i32 {
    `ret %val`;
}

fn main() {
    let a = 123;

    $assert(deref(&a) == 123, nil);
    $assert(add_one(a) == 124, nil);
    $assert(identity(a) == 123, nil);
    $assert(`identity`(a) == 123, nil);

    // The function name can be represented without exact literals too in this case
    $assert(`identity`(a) == identity(a), nil);

    io::println("All `exact literal` tests have passed!".color("green").reset());
}
#

it would simplify the compiler quite a lot to get rid of the whole inline IR thing, there are a lot of compiler hacks to bypass it and make this work

#

but it makes the language more interesting

#

its not even very useful anymore for anything

shrewd canopy
valid jetty
#

why would it be useful

valid jetty
#

they define an "exact literal"

#

when its in the case of a top level statement, it acts like an IR instruction

#

when in the case of a function decl or call, it acts like a raw string

jade stone
valid jetty
#

An exact literal is Elle's way of implementing inline IR into the language. This basically means that you can write intermediate language code directly in Elle which compiles without any type, size, scope, or name context.

You can create an "exact literal" by wrapping the inline IR with "`" on both sides of the expression, and ensuring you include a semicolon at the end.

You can also use the manual return directive, which states that Elle should NOT include an automatic return if the function does not return anything by default. You can do this by adding the @manual attribute to your function.
@jade stone

jade stone
deep mulch
#

what does that mean

jade stone
deep mulch
#

hate

jade stone
#

@deep mulch rate horrorcode

nmd: if (importUses?.uses.length === 1) {
    const loc = importUses.uses[0].location;
    const call = findParrent(loc, isCallExpression);

    if (!call || call.arguments.length !== 1 || call.arguments[0] !== loc)
        break nmd;

    // ensure the call is `n.n(...)`
    const funcExpr = call.expression;

    // ensure something like `foo.bar`
    if (!isPropertyAccessExpression(funcExpr)
        || !isIdentifier(funcExpr.name)
        || !isIdentifier(funcExpr.expression))
        break nmd;
    // ensure the first part is wreq
    if (!this.isUseOf(funcExpr.expression, this.wreq)
        || funcExpr.name.text !== "n")
        break nmd;

    const decl = findParrent(funcExpr, isVariableDeclaration)?.name;

    if (!decl || !isIdentifier(decl))
        break nmd;

    this.vars.get(decl)
        ?.uses
        ?.map((x) => x.location.parent)
        .filter(isCallExpression)
        .map((calledUse): Range[] | undefined => {
            if (exportName === WebpackAstParser.SYM_CJS_DEFAULT) {
                // TODO: handle default exports other than just functions
                return isCallExpression(calledUse.parent)
                    ? [this.makeRangeFromAstNode(calledUse)]
                    : undefined;
            } else if (typeof exportName === "string") {
                const expr = findParrent(calledUse, isPropertyAccessExpression);

                if (!(!!expr && expr.expression === calledUse && expr.name.text === exportName))
                    return undefined;

                return [this.makeRangeFromAstNode(expr.name)];
            }
            throw new Error("Invalid exportName");
        })
        .filter((x) => x !== undefined)
        .forEach((use) => {
            const final = use.at(-1);

            if (!final)
                throw new Error("Final is undefined, this should have been filtered out by the previous line as there should be no empty arrays");

            uses.push(final);
        });
}
valid jetty
#

you can break if statements ?????

jade stone
deep mulch
#

yea

valid jetty
#

glorified goto

deep mulch
#

rosie insane

jade stone
#

you can label any statment iirc

valid jetty
#

wait ANY statement??? so i can just have like IIFE behavior in my functions

#

like the reason i want

(() => {
    const x = 1;
    if (!x) return;
})()
``` is so i can break out with return
#

does this mean i can do

foo: {
    const x = 1;
    if (!x) break foo;
}
valid jetty
#

wtf

#

best feature

jade stone
#

thats why im doing it blobcatcozy

#

this logic need to have early returns

#

and its only used once

#

so i dont want to extract it to its own function

valid jetty
#

yeah i would wrap that in an IIFE

#

thats amazing

jade stone
#

you could label the if statment itself, but that just looks a lot worse and wouldnt keep locals in their own scope (not like there are any locals in that scope anyway)

royal nymph
#
do {
  const x = 1;
  if (!x) break;
} while (false);
#

labels overrated

winged mantle
#

why use goto when you can use cometo

#

(copy and paste the code from where you wanted to goto to where you called it)

full spireBOT
#
Error

Unfortunately an error occurred during command processing

#
Error

Unfortunately an error occurred during command processing

deep mulch
#

bruh

full spireBOT
full spireBOT
#

Decoded SSTV image

jade stone
#

@deep mulch me when my horrorcode works first try

deep mulch
#

guhh

deep mulch
#

@jade stone why is sstv so poorly documented

jade stone
#

whats that

deep mulch
#

Slow-scan television (SSTV) is a picture transmission method, used mainly by amateur radio operators, to transmit and receive static pictures via radio in monochrome or color.
A literal term for SSTV is narrowband television. Analog broadcast television requires at least 6 MHz wide channels, because it transmits 25 or 30 picture frames per secon...

jade stone
#

insane

deep mulch
#

watch this

full spireBOT
#
Error

Unfortunately an error occurred during command processing

deep mulch
#

why didnt it copy

#

what

#

i found a vencord bug

jade stone
deep mulch
#

copy link does not copy

jade stone
full spireBOT
#

Encoded SSTV audio with Martin 1 mode

#

Decoded SSTV image

jade stone
#

crunchy

deep mulch
#

guhhh somethings wrong with the decoder

#

its niot supposed to be that crunchy

jade stone
#

@deep mulch are you on vesktop, web or stable

deep mulch
#

vesktop

jade stone
deep mulch
#

yes

uneven gate
#

I've been making a plugin with a setInterval but it breaks after my computer goes to sleep

doing some research I could fix this by using powerMonitor

import { powerMonitor } from "electron";
...
start() {
    createInterval();
    powerMonitor.addListener('suspend', () => clearInterval(interval));
    powerMonitor.addListener('resume', createInterval);
}

It yells at me saying

Cannot import electron in browser code. You need to use a native.ts file

Is there any docs for how to use a native.ts file in vencord? I tried looking at how other plugins do it but I'm new here and cant read them

dense sand
jade stone
dense sand
jade stone
#

insane

dense sand
#

i honestly didnt know how else id write it lol

#

well i actually got an idea

#

im thinking of opensourcing it so people can laught at my trash C code

uneven gate
# dense sand wow

why can't you just do something like this? am I stupid?

NATIVE(java_lang_Class_getPrimitiveClass) {
  char *name = ToString(vm, (ObjectRegion*)ToAddress((struct Variable*)argv[0]));

  char *primitiveName = NULL

  if (strcmp(name, "int") == 0) {
    primitiveName = "java/lang/Integer";
  }
  if (strcmp(name, "long") == 0) {
    primitiveName = "java/lang/Long";
  }
  if (strcmp(name, "short") == 0) {
    primitiveName = "java/lang/Short";
  }
  if (strcmp(name, "boolean") == 0) {
    primitiveName = "java/lang/Boolean";
  }
  if (strcmp(name, "byte") == 0) {
    primitiveName = "java/lang/Byte";
  }
  if (strcmp(name, "char") == 0) {
    primitiveName = "java/lang/Character";
  }
  if (strcmp(name, "float") == 0) {
    primitiveName = "java/lang/Float";
  }
  if (strcmp(name, "double") == 0) {
    primitiveName = "java/lang/Double";
  }
  if (strcmp(name, "void") == 0) {
    primitiveName = "java/lang/Void";
  }
  
  free(name);
  return CreateVariable(STACK_ELEMENT_IS_ADDR | STACK_ELEMENT_LONG, primitiveName);
}
dense sand
uneven gate
dense sand
leaden crater
#

hell descends on earth with strcmp

uneven gate
#

@dense sand why are you writing a jvm in c?

uneven gate
#

real

dense sand
#

it was kinda my dream always

uneven gate
#

.. to make a jvm?

dense sand
#

yes lol

#

i want to make it wasm compatible so i can run this on web

uneven gate
#

you should do the BEAM next (30 years)

jade stone
uneven gate
#

java

dense sand
#

jvm in java

#

peak

uneven gate
leaden crater
# uneven gate why can't you just do something like this? am I stupid? ```c NATIVE(java_lang_Cl...

why not just

NATIVE(java_lang_Class_getPrimitiveClass) {
  char *name = ToString(vm, (ObjectRegion*)ToAddress((struct Variable*)argv[0]));
  
  char *primitiveName = 
    (strcmp(name, "int") == 0) ? "java/lang/Integer" :
    (strcmp(name, "long") == 0) ? "java/lang/Long" :
    (strcmp(name, "short") == 0) ? "java/lang/Short" :
    (strcmp(name, "boolean") == 0) ? "java/lang/Boolean" :
    (strcmp(name, "byte") == 0) ? "java/lang/Byte" :
    (strcmp(name, "char") == 0) ? "java/lang/Character" :
    (strcmp(name, "float") == 0) ? "java/lang/Float" :
    (strcmp(name, "double") == 0) ? "java/lang/Double" :
    (strcmp(name, "void") == 0) ? "java/lang/Void" : NULL;
  
  free(name);
  return CreateVariable(STACK_ELEMENT_IS_ADDR | STACK_ELEMENT_LONG, primitiveName);
}
``` or something, this should work no?
leaden crater
#

they're pretty good

uneven gate
#

Ternaries should only ever be 1 line imo

leaden crater
leaden crater
#

do you want an implementation with goto?

uneven gate
dense sand
#

Teavm is jvm compatible for web

uneven gate
jade stone
#

i swear im going to have a 2000 line file just for parsing webpack ASTs by the time im done with my vencord extension

leaden crater
#

or you can just write a switch case anyways

uneven gate
#

I think multiline/nested ternaries are a mistake
react kinda solidified this viewpoint for me

uneven gate
jade stone
leaden crater
#

insane

uneven gate
leaden crater
#

1 billion line ternary operators for every number

jade stone
leaden crater
#

is discord open source even

jade stone
leaden crater
#

otherwise it's just weird binary translated

uneven gate
jade stone
#

but the most annoying thing for me was not being able to see where things were in the source

#

so i made go to definition and list references for the minified code blobcatcozy

uneven gate
# leaden crater because you're using too many lines for something that can be written shorter us...
let primitiveName: Option<&str> = match name {
    "int" => Some("java/lang/Integer"),
    "long" => Some("java/lang/Long"),
    "short" => Some("java/lang/Short"),
    "boolean" => Some("java/lang/Boolean"),
    "byte" => Some("java/lang/Byte"),
    "char" => Some("java/lang/Character"),
    "float" => Some("java/lang/Float"),
    "double" => Some("java/lang/Double"),
    "void" => Some("java/lang/Void"),
    _ => None,
};

Actually nvm it doesn't look any better

hoary sluice
#

dont you parse the entire function body as ir

hoary sluice
hoary sluice
#

rosie whats the convolved impulse respones of two identical RC filters with the impulse response 1/Ο„ * e^(-t/Ο„)

deep mulch
#

@leaden crater hii

leaden crater
#

@deep mulch hiii

deep mulch
#

@jade stone boo

jade stone
deep mulch
#

should calling init more than once just silently skip or throw error

leaden crater
#

@deep mulch

deep mulch
leaden crater
deep mulch
leaden crater
deep mulch
#

yws

dense sand
#

does anyone know how can i intellij tab this properly so the values are prettily under each other

lavish frigate
#

😭

dense sand
#

i srsly dont know 😭 please help

dense sand
#

Yes

#

I define

leaden crater
#

why

hoary sluice
#

actually probably depends on the system

dense sand
#

Its for my parsing library

leaden crater
#

can't you just use the numbers

fleet cedar
#

You should use consts

dense sand
#

Its 250 instructions

fleet cedar
#

It's 250 words that are now 100% synonymous with those numbers in every context

#

Namespacing please

dense sand
#

I use raw C

#

No namespaces

fleet cedar
#

Ew

#

Why

dense sand
#

I like C

leaden crater
#

crazy

ornate quiver
#

typically raw C means you prefix stuff to names

valid jetty
#

you can insert IR instructions anywhere in a function

#

@manual just tells the compiler not to insert a manual return statement if the function returns before via IR (as that’s not tracked by the compiler)

#

there are at least 6 hacks throughout the whole project to allow that to work

formal belfry
#

a

valid jetty
#

ok ive restricted the dialect of what you can say with exact literals

#

you can no longer do inline IR with them

#

but you can still do this

use std/io;

fn `add.works`() {
    $assert(42 + 42 == 84, nil);
}

fn `mul.works`() {
    $assert(42 * 2 == 84, nil);
}

fn main() {
    `add.works`();
    `mul.works`();

    io::println("All `exact literal` tests have passed!".color("green").reset());
}
fleet cedar
#

My decompiler also has that exact syntax for raw identifiers

#

It's used in exactly one place in the decompiled codebase

#

A call to debug.`TestScenarioflagSet( GF1_EV_02_32_03_END )`()

valid jetty
#

lmao insane

#

i wonder, how do you handle spaces in something like this

fleet cedar
#

I don't see why spaces would be different from any other letter

valid jetty
#

because my raw identifiers just put the characters exactly as they are into the IR

fleet cedar
#

Maybe if the ir itself gets confused, that'd cause trouble

valid jetty
#

which, as expected, causes an IR error if theres spaces

fleet cedar
#

Guess that's fair

#

That's what mangling is for isn't it

valid jetty
#

but i dont wanna transform the raw identifier because then its no longer a raw identifier so idk

valid jetty
fleet cedar
#

Only mangle things that need mangling?

valid jetty
#

i mean i guess so hm

fleet cedar
#

I need to make my lexer not allow rawing keywords though

dense sand
#

Why such a mess? I got 3/(cosΒ²(3x-Ο€/4))

leaden crater
#

even if it doesn't say steps

hoary sluice
pine prawn
#

What language is that..?

valid jetty
#

its a language im working on called elle

#

@deep mulch I FINALLY ADDED ELSE IF 😭

#

after all this time

#

this

use std/libc/io;

fn main() {
    x := 4;

    if x == 1 {
        io::cprintf("hi x = 1\n");
    } else if x == 2 {
        io::cprintf("no way x = 2\n");
    } else if x == 3 {
        io::cprintf("omg x = 3\n");
    } else {
        io::cprintf("whaa x = %d\n", x);
    }
}
``` when compiled with `--noalloc --nostd --nofmt --nosm` compiles into
```ts
type :ElleEnv = { l, l, l }
type :ElleMeta = { l, l, w, l, l, w, w }
data $.54 = { b "hi x = 1\n", b 0 }
data $.57 = { b "no way x = 2\n", b 0 }
data $.60 = { b "omg x = 3\n", b 0 }
data $.62 = { b "whaa x = %d\n", b 0 }
export function w $main() {
@start
    %x.addr.51 =l alloc8 4
    storew 4, %x.addr.51
    %x.50 =w loadw %x.addr.51
    %tmp.53 =w ceqw %x.50, 1
    jnz %tmp.53, @ift.53, @iff.52
@ift.53
    %tmp.55 =w call $printf(l $.54, ...)
    jmp @end.52
@iff.52
    %x.50 =w loadw %x.addr.51
    %tmp.56 =w ceqw %x.50, 2
    jnz %tmp.56, @elift.55.0, @eliff.55.0
@elift.55.0
    %tmp.58 =w call $printf(l $.57, ...)
    jmp @end.52
@eliff.55.0
    %x.50 =w loadw %x.addr.51
    %tmp.59 =w ceqw %x.50, 3
    jnz %tmp.59, @elift.58.1, @eliff.58.1
@elift.58.1
    %tmp.61 =w call $printf(l $.60, ...)
    jmp @end.52
@eliff.58.1
    %x.50 =w loadw %x.addr.51
    %tmp.63 =w call $printf(l $.62, ..., w %x.50)
    jmp @end.52
@end.52
    ret 0
}
leaden crater
valid jetty
#

close enough

leaden crater
#

:3

fleet cedar
valid jetty
#

its easy on paper but implementing it is kinda annoying

fleet cedar
#

Nah, just need to add one more clause in the parser after else

valid jetty
#

my parser isnt a traditional recursive descent parser

fn parse_if_statement(&mut self) -> AstNode {
    self.advance();

    let tokens = self.yield_tokens_with_delimiters(vec![TokenKind::LeftCurlyBrace]);
    let expression = Statement::new(tokens, 0, &self.body, self.shared).parse().0;

    self.expect_tokens(vec![TokenKind::LeftCurlyBrace]);
    self.advance();

    let body = self.yield_block(false);

    let mut elifs: Vec<(Box<AstNode>, Vec<AstNode>)> = vec![];
    let mut else_body: Vec<AstNode> = vec![];

    loop {
        if self.current_token().kind == TokenKind::Else {
            self.advance();

            if self.current_token().kind == TokenKind::If {
                self.advance();

                let tokens = self.yield_tokens_with_delimiters(vec![TokenKind::LeftCurlyBrace]);
                let elif_condition =
                    Statement::new(tokens, 0, &self.body, self.shared).parse().0;

                self.expect_tokens(vec![TokenKind::LeftCurlyBrace]);
                self.advance();

                let elif_body = self.yield_block(false);
                elifs.push((Box::new(elif_condition), elif_body));
            } else {
                self.expect_tokens(vec![TokenKind::LeftCurlyBrace]);
                self.advance();

                else_body = self.yield_block(false);
                break;
            }
        } else {
            break;
        }
    }

    self.position -= 1;

    AstNode::IfStatement(IfStatement {
        condition: Box::new(expression),
        body,
        elifs,
        else_body,
        location: self.current_token().location,
    })
}
``` and also the parser isnt the hard part its the codegen thats hard
#

making everything jump to the next thing properly was annoying

fleet cedar
#

How

#

It's literally just an if-else with another if in the else branch

#

And that looks like a pretty standard recdesc to me anyway

valid jetty
valid jetty
#

its not hard but its easy to get confused in my head

fleet cedar
#

I mean sure if you want to represent it as ```rs
struct IfStmt {
expr: Expr,
then: Block,
elseifs: Vec<(Expr, Block)>,
else_: Option<Block>
}

valid jetty
#

its ```rs
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct IfStatement {
pub condition: Box<AstNode>,
pub body: Vec<AstNode>,
pub elifs: Vec<(Box<AstNode>, Vec<AstNode>)>,
pub else_body: Vec<AstNode>,
pub location: Rc<Location>,
}

#

how else can you represent it

#

i thought i did an interesting thing by making the else_body not an Option<T>, because then having an empty else {} will still make the body be empty and so the compiler will skip the else branch altogether

fleet cedar
#

I'd just go with a ```rs
struct IfStatement {
expr: Expr,
then: Block,
else_: Else,
}
enum Else {
None,
ElseIf(IfStatement),
Else(Block),
}

#

Or just have it always be a Block, which has 0, 1, or N elements depending on style

valid jetty
#

hmmm actually a good idea

#

i might do that thank you

#

but it would be a Vec<Else> surely

fleet cedar
#

Why?

#

The inner IfStatement has its own else

valid jetty
#

oh its recursive i didnt notice that lol

#

this really looks like a parser representation of

if true {
    ...
} else {
    if true {
        ...
    }
}
``` lmao
#

beautiful

fleet cedar
#

Yep

valid jetty
#

for the longest time thats basically what i was doing anyway

#

but its more of a syntax hack than a language feature

fn char::unicode_length(char self) {
    if (self & 0b10000000) == 0 {
        return 1;
    } else { if (self & 0b11100000) == 0b11000000 {
        return 2;
    } else { if (self & 0b11110000) == 0b11100000 {
        return 3;
    } else { if (self & 0b11111000) == 0b11110000 {
        return 4;
    }}}}
}
fleet cedar
#

Sure you'll end up with multiple consecutive labels at the end, but if that causes issues for your backend then said backend sucks

valid jetty
#

nope i dont think it would

dense sand
#

Binary integers arent a C thing until C23, thats wild

valid jetty
#

is this a sane way to test this???

fn main() {
    `if.works`();
    `if.else.works`();

    `if.else_if.picks.if`();
    `if.else_if.picks.else_if`();

    `if.else_if.else.picks.if`();
    `if.else_if.else.picks.else_if`();
    `if.else_if.else.picks.else`();

    `if.else_if.1.else_if.2.picks.if`();
    `if.else_if.1.else_if.2.picks.else_if.1`();
    `if.else_if.1.else_if.2.picks.else_if.2`();

    `if.else_if.1.else_if.2.else.picks.if`();
    `if.else_if.1.else_if.2.else.picks.else_if.1`();
    `if.else_if.1.else_if.2.else.picks.else_if.2`();
    `if.else_if.1.else_if.2.else.picks.else`();

    $println("All `if statement` tests have passed!".color("green").reset());
}
#

im glad i even wrote a test for this because it turns out i was handling the label wrong when theres a bunch of else-ifs but no else

pearl stagBOT
fleet cedar
#

Such is the life of a c

dense sand
#

i mean what else could i do in C++