#🪅-progaming
1 messages · Page 33 of 1
lmfaoo
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
blom senior
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
c3 also requires passing values into lambda like that
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
<:i:1263592450136473684> defenestrate diːˈfɛnɪstreɪt
verb
- 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
- remove or dismiss (someone) from a position of power or authority.
- the overwhelming view is that he should be defenestrated before the next election
xdd
ok well this is basically what i did today
it looks super weird
but it actually works correctly
there is no commonly used word for the day after tomorrow yet there is a word for throwing someone out of a window
Overmorrow?
not commonly used
Neither is defenestrate
i have heard the word defenestrate more often than the word overmorrow or ereyesterday
2 times vs 0 times
wtf is : let
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...
in slovak we have "pozajtra"
"zajtra" means tomorrow
"po" means after
its just together
日本語では「明後日」って言うよ
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 明後日"
That だと sounds strange imo
you could probably also say では?
Yeah that sounds more sane
yeah
DEFENSTRACE MENTIONED
WTF JE TŘICETILETÁ VÁLKA 🦅
🔥
we have (transliterated) poslezavtro
@valid jetty i think i just found the worst website
its a university campus housing site
- it looks awful
- 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
- 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$
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
but you just said its rsa encrypted
when you sign up they send you an email with
username: <your last name>
password: <city of the uni>#1
encrypting passwords seems like a terrible idea lol
then you can change it but youre not forced to
i mean on other keyboards i can type at 120wpm with pretty good accuracy
you hash
pgp encryption for my password 😍
i used to type 160 with good accuracy like a month ago but i kinda forgot row staggered keyboards/qwerty so my accuracy is shit now
surely they dont store the private key and just use rsa for hashing
Nobody'll get them then
encrypting the password is like locking your key in a safe
oh also you literally just cant log in
Throw the key to the safe into a river
like it just says ur password is wrong after doing the rsa paste thing even tho its stored in my password manager
you're just putting the password in a different place
and they have to store the private key somewhere to decrypt, so it's basically equivalent to storing inplain text
i base64 hash my passwords
i think it's kind of bad if applying the slightest of pressure to a key presses it without making much sound
nah put it in a glass box, cover it in cement, light it on fire, put it in galvanived square steel, send it to the moon and then nuke the moon
Guh
We should make people physically log in for maximum security
i turn my password into an array of i8 and add the i8s
Gotta go to google HQ to log into gmail
take the x coordinate of your password, multiply it by 100 and then add the y coordinate
personally i do a pathfinding to find the optimal password that i should make for each website
the password is actually an elephant and he wants you to simulate 1 trillion rocks
the heuristic is the amount of negative reviews on better business bearau
i run my passwords through game of life until it stabilizes
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
if im unlucky it wont stabilize and then i just dont log in
through 13 universes while running game of life and chinese remainder theorem to determine when they will align?
Can i talk about JavaScript here?
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
Oh yeah and then I give the locations of each part to a different person and acquire a brain injury so I forget where they're buried
Damn
j*vascript (yes)
So I have to fight each person to the death to get each part
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
is this a day 25 of 2026 reference
Oh I was about to come up with an original thought but somebody has already made it
Curse you whoever already made parallelized bogosort
lmao
bogosort 
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
@valid jetty our sleep schedules are slowly syncing
every day im going to sleep later
its 11:30 and im playing bedwars
idk if i should say "good" or "bad" lol
i stayed up until 5am last night you have a little to go
what is fzf
fuzzyfind
what 😭
ty
how are you alive
lmao
every day i say im gonna go to sleep at 10 today
it never works
so today i just gave up
it worked in aoc but now i have nothing to wake up for
lmao exactly
problem is if you do that then youre gonna sleep longer
better to go sleep early and wake up even earlier
but its hard
gn
i slept for approximately 12 hours last night and im already tired at 23:30
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
use €
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 (???)
$stdlib_global
€imported_symbol
£project_global
😭
genius
make it xp for british users
php but good
USDnum = 1;
USDnum++;
echo USDnum;
true,,,,,,,,,,,,,
Perl
$ should be used for piping or lambdas
I think it fits well for lambdas
$ should be for blocking functions , which are expensive to call
huh
lmfao
lambdas are fn(i32 x) x + 1 or fn(i32 x) { return x + 1; }
depending if you need multiple lines or not
(this is not a functional language)
.
this is unnecessarily long
gn
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)
i think it was a good idea to add this to the docs
i think i can make it @ instead of $
@assert and @dbg is much nicer than $assert and $dbg
ok this might be a bit harder than i initially intended because of how i did it in the lexer
@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);
}
why is this actually so simple
cursed
yeah
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)
many
ok good night
6:16am
😭

good morning
@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
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)
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
compiler.rs: Lines 2760-2762
if ty.is_struct() {
return Some((Type::Pointer(Box::new(ty)), val));
}
the address of a struct is just the same value interpreted as a pointer
gotta love java
$dbg is a shortcut for io::dbg?
yes
there’s a few
that’s not all of them tho there’s a few more https://github.com/acquitelol/elle/blob/rewrite/std/io.le#L147-L152
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");
@valid jetty```rs
'>' => if let Some('=') = self.next() {
self.advance();
TokenKind::GreaterEqual
} else {
TokenKind::Greater
},
ignore the indenting
Looks like a if self.eat('=') { Ge } else { Gt } to me
Sure you can call it eat_if if you prefer
self.next_is(TokenKind::Equal)
in else it should also revert
if eat() eats it
fn consume_if(&mut self, c: char) -> bool {
if matches!(self.next(), Some(cc) if cc == c) {
self.advance();
true
} else {
false
}
}
'>' => {
if self.consume_if('=') {
TokenKind::GreaterEqual
} else {
TokenKind::Greater
}
}
ty
wtf is this
lexer.rs: Lines 305-326
'>' => {
self.advance();
match self.current_char() {
'>' => {
self.advance();
match self.current_char() {
'=' => {
self.advance();
(TokenKind::ShiftRightEqual, ValueKind::Nil)
}
_ => (TokenKind::ShiftRight, ValueKind::Nil),
}
}
'=' => {
self.advance();
(TokenKind::GreaterThanEqual, ValueKind::Nil)
}
_ => (TokenKind::GreaterThan, ValueKind::Nil),
}
}
u advance inside the match arms??
why does r-a not detect this
set it to a variable and look at its type
why
i meant it should detect that Ok(func()?) is just func()
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
Only if the error type is the same
oh true that too
it is
all my errors are from my error mod
yeah i found it
did you not work on it for a while or do you just have 5 days of commits lmao
wdym
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
i was doing aoc
its getting there
css 
i wonder if ill have more rust than kt when this is done
javascript 
how are you not in a mental facility after writing this much js
im sure ive shown you the absolutely cursed things ive made in js
holy shit i didnt even realise this thing is still public https://github.com/acquitelol/autobookwork
its a scraper for sparx
😭
🗿 🗿
lMAO
why is that site purple
wha
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
is it one of those where you have to show your work and if the spaces dont match its wrong
is that kali
yea
so true
I hated writing down my working in school
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
Since teachers insisted that I had to make up extra intermediate steps that I didn't do
sameeee
is this latex but json
no it stores latex as a string in json lol
that is latex
or well close enough
i rewrote their cursed latex system thing
why is here so much smart people, i feel dumb for not knowing how to solve integrals at 17 😭
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(''));
};
basically you can do abc $latex_{here}$
lol dont worry you learn pretty fast
integrals are much easier than they seem
dw i cant either
no theyre not
at least 1 dimensional integrals are pretty easy
only math i know is what i learned from aoc and 3b1b videos
consider khan academy
(graph theory, set notation, and linalg from 3b1b)
very good videos and the multivariable calculus ones are made by grant sanderson (the same person who runs 3b1b)
its so slow
i watched them in 1.5x
still too slow
an hour to explain basic matrix operations is just too long
he writes down every step
if you understand it already then go straight to the questions lol
noones stopping you
3b1b explains really well
yeah he explains very well in mv calc too
wtf lol
he looks exactly what i expected him to
this is the kind of thing you see in mv calc https://youtu.be/hQ4UNu1P2kw
Courses on Khan Academy are always 100% free. Start practicing—and saving your progress—now: https://www.khanacademy.org/math/multivariable-calculus/applications-of-multivariable-derivatives/lagrange-multipliers-and-constrained-optimization/v/the-lagrangian
How a special function, called the "Lagrangian", can be used to package together all th...
pls 1.5x
mine
evil
i have so much python
@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
you're working on elle -> js ?
why
idk
but thanks anyway
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
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
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
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
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
@valid jetty im starting to get demotivated about icps because rust is so perfect and awesome
rust has 0 issues
its the perfect language
until you try to do anything with aoc in it and get stuck in as usize hell
lmao
cause intcode requires long indices
this is why you use a real programming language like javascript
so true??
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
lmao
Why is it still not rewritten in rust
probably noone can understand it enough to write it in rust
nice abbreviations
very demure
very maintainable
Bro whats the point of abbreviating link to lnk
rosie try to write readable code challenge
i didn’t write that code 😭
it’s part of the code for the intermediate representation i’m using for my compiler
💀
whats funnier is that its called link in Blk but lnk in Fn
readable ✨
nah, create icps
you'll not regret it
you'll be #1 every day
dont have anything that isnt usize then smh
rust is a bit verbose
but it has a lot of features that i love
it was a joke
itll be like 10s faster than kotlin
kotlin is already like the best option i have
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
tree sitter
tree sitter so fucking horrible
@ornate quiver what is husk on this
I'm a chair sitter myself
for ..blom?
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
build.gradle.kts where
kotlin script is too unstable and we will be staying with groovy in prod
Build script in clojure please
yeah
build.zig where
omg no
i dont know 💀
i just did tree-sitter-cli init
and it generated everything

lol
explode
kotlin buildscript my beloved
I would never use groovy
i love type inference
as const 
program
yea but where do you put it
is it ? "string" as const : "regex" as const
if so
both strings I guess you are forced to that
on the isStringLiteral call
@valid jetty https://youtu.be/Njswjwz7K6M
I explain how I got the world record on Veggie Quest level 24-3 with simulated annealing and BFS.
also why r u awake
wait what are you even trying to do
have findType be infered as "string" | "regex"
ah
Yeah
..?
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)
types shyuld never be strings
who desinged this shit
What should they be then?
what
Yeah because most languages actually have types
this is just types as values
lmao
that is saying a is either the literal string or the literal regex
Python also uses typing.Literal fairly often
is it because regex is a valid identifier in js and it needs to be a superset of js?
what
/foo/ is not a valid identifier what are you talking about
what
why is it behind a :
oh wait i get it
i forgot js has objects
this is why its useful
That function returns a value of the type "the literal 'string' or the literal 'regex'"
why is that a thing
because the typescript type system is very powerful
What would be a thing otherwise?
is that actually useful
just a string?
Quite
So a string that you know nothing about?
That's significantly less powerful
yes like all other languages
I'm quite a fan of knowing "when I index this object with this specific string, I get an int"
if you want "string" | "regex" then make an enum
It's quite more powerful than "when I index this object with any string, I get an int"
you can also do type narrowing
you can do that
Js does not have enums
ts does
that just seems extremely bug prone
doesnt mean ts cant
guys help
how would i send a message with a vencord plugin
like is there a function to send a discord message
"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
with fluxdispatcher or soemthing
How would you write something like { type: "none" } | { type: "some", value: int } with enums
@fleet cedar isnt this just better?
^^^
make value enums
Not really, that's just needless boilerplate over regular { string: 1, regex: 2 } syntax
@hoary sluice how would you do this if string literals couldnt be types
yea but i feel like having strings be types will cause a lot of bugs/compile time annoyances
idk if it does cause i dont use ts
sendMessage func from @utils/discord (needs channel id) I'm on my phone so I don't know if this is 100% right but should be roughly ok
Your feelings don't really matter much compared to what, decades of industry usage
can u link to it or somehting
if not ill find it myself
ok found it
decades of industry usage caused https://jsfuck.com/
I find unions of literals to be a very elegant model for what it is
yeah
👍
what is this useful for
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
is it possible to change the nonce too
can someone help i wanna send a message with custom body and nonce
btw @hoary sluice typescript type system is just a functional language
I'm pretty sure the discord api might let you work with custom message stuff
or i guess
yea but i wanna try it out tho
The "Create Message" endpoint according to some guy on github
yea i dont understand why you want a turing complete type system
Probably because not turing complete was not a design goal
where
send link
Are you making a bot or a plugin
https://github.com/discord/discord-api-docs/issues/955
Requires getting user token tho which can be kinda sketchy and also "user botting rules" or sumn
Today, nonce in the Create Message endpoint allows you to supply: null int string bool an empty json object {} an empty json array [] and errors on any other JSON value with {"nonce": [&q...
RestAPI already has the token, doesn't it?
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
Considering messages can be deleted, it seems reasonable to assume three's an endpoint for that
Look it up in the source
Or the api docs
Or devtools
Or probably a few other methods
you will read https://discord.sex
You’ve found the Unofficial Discord User API Documentation! These pages are dedicated to showing you all the ways that you can use Discord to make cool stuff. It is not an official source of informati...
also if your only goal is to look cool on messagelatency ur just an idiot
Why is .sex a tld
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
its impossible :((( 😭 
wait actually
no lol
i was hoping maybe it stood for spare educational xylophones
i would but idk discord api
pruh
you know there's this thing called as function return values
perhaps a console.log would help
^^
or maybe shiggy entree of xemilofibans
yea once i asked that i suddenly remembered that
:P
Do kdy mate sakra volno
I love my discriminated unions
now is there a way to delete a message too
it uses the DELETE method
so idk
heplp
im too dumb for this
scooby doos enterprise of xenophobia??
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?????????||
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);
all the schools ive been to use microsoft outlook
and thats probably the most accepted option
oh
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)
how do i set that up
if you tell your teachers they need to log in to protonmail its probably just gonna confuse them
school using proton mail would be so fire
but how will that work
create new account in outlook or proton for each teacher for name@school.edu?
it outlook youd use microsoft 365 education and they probably have an easy process
what type of school is it
high
technical or normal
is it focused on it
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
)
i mean if you want it centralized you pretty much have to pick between outlook and google workspace
if you want admins to be able to read students emails
paid?
you aren’t finding anything good for free
outlook has meh free tier and like 5$ per user per month, google has 5$ per user per year
id personally do protonmail but idk if admins being able to read student emails is a requirement
most schools are heavily microsoft integrated
||just get their account password||
windows pcs, outlook email, a windows local domain thing to log in, admins can change student passwords
me when they change it and then forget it
you can save their recovery phrases
@valid jetty have u used rust outside elle
oh ok ic, but with $5/month/user but that's gonna be $5000/month which is like $60k/year just for some mail wtf??
i wrote an async web socket server for enmity
maybe there are deal to get it for cheaper idk
have u used anyhow or any other error handling crates
i haven’t used it but i know how it works
@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);
}
thats cool
garbage collection soon now
i just need to find these roots aswell as roots in the heap itself and then recurse from there
🔥
what
isnt the whole point of qbe that you dont need to do that
yes
but what im doing is also quite unconventional lol
or well
its not the most basic program
oh and this is what i meant by seperate assembly
not really that complicated just returns rbp/x29
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
you could potentially use that only for teachers and then students have personal emails instead
if it’s a technical school the students would prefer that anyway probably
ah yeah
you should try #🧩-plugin-development
(i have experience with incoming connections, but not outoging connectoins
can someone here work with cheerio
i dont have access to that channel
make a ticket in #📩-modmail
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
I forced chatgpt to make a pygame os and it is just horrible
which option do i pick? 😅
"updated"
I want to talk to a mod
oh alright thanks
@valid jetty @placid cape
it doesnt just say this anymore
now time to make it print the arrows pointing to the code
nice
Wtf happened to bitcoin today lol
i think holiday ended so people went and bought
programing
:)
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
YOOOO ITS THE PEE PACKAGE https://www.npmjs.com/package/pee
the command is "npm i pee"
rust is high level
:crab: Small exercises to get you used to reading and writing Rust code! - rust-lang/rustlings
oh
rust is high level but provides you low level control if you need it
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
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
i mean yeah but like in python i didn't have to think of how it works because it's already implemented in one of the libraries built in python
theres only really 1 right way
there is always something that is better than everything else in a given context
i think i understand where theyre coming from
theres always a best way
there is but there is also a lot of ways to do that
but one of them matches the context the best
i guess
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
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
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;
but if after that i do file.read_exact(&mut buffer)?, will it again read the first four bytes?
or the next four bytes
also speaking of c, i wish i could convert AOB to struct
afaik there's no easy safe way of doing so in rust
next 4
u can do it manually or with unsafe{}
or maybe @valid jetty knows better sol
gn
whyyy :(
@hoary sluice @placid cape
seems like that's the only way i can write :(
Ew, unwrap
try T : Sized in the generic definition
i tried adding where T : Sized if that’s what you mean but it didn’t work
yeah dunno then
if you're implementing parsing a binary format there's libraries that do this better
like the scroll crate
yeah i can just use a library for sure, but as i said:
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
but if there's really no easy way, then i guess i'll just stick with what works
up to you
generally people hesitate less to use crates because the build & dependency system is amazing unlike pip
true
opening an average rust project i would see much more dependencies than i would see in python
lmao
why comment it instead of deleting it?
its faster
perfect place to use traits
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;
}
its the js treatment all over again
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));
}
};
})();
}```
js is always cursed
now the question is... why?
vscode horror ui
i dont want to write a custom webview
why is it inside a class tho
because it has to be
a class inside a class
the vscode api calls the constructor
someone has to write the statement and there is no reason to overcomplicate it
in a modern company there would be 18 meetings held and 3 sprints planned for this
@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()
);
})
),
]);
}
}
i see a lot of deps in python as well
no idea what's happening here lmaoo
it needs to be a class because otherwise you would have to re-render the parent of the element you wanted to re-render
why can't dynamic node be outside
wdym
DynamicNode definition outside class a
because to re-render you need a field of the class
you can't edit the constructor to pass the provider as a prop?
yea, but i dont want to pass it every single time i do it
i could prob throw it outside and do some proxy fuckery, but cant be bothered
rosie waking up an human times???
@valid jetty how to make runtime resolved precedence
yeah but i slept at 3am
If you mean operator precedence, that's resolved at compile time
i’m not actually sure of the best way to do this gimme like 5 mins to think
he wants to do runtime based
like a language called noulith does
Usually at parse time, but it depends on how flexible your operator overloading and custom operators are
ik, i want it at runtime
How does that work
im probably gonna implement it at parse time and then try to do it later once i have reflection or smth
idk
noulith does it
there are builtin functions to change it at runtime
i might look at his src
have you ever tried to explain reflection to someone who barely knows what a class is
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
that is really annoying to do with a recursive descent parser i think
i have had to explain what a function is
to someone who has been learning c for 2 years
and i also want to be able to give precedence to functions
you could do the approach i did in elle for my precedence parser
it’s not exactly recursive descent it’s a custom algorithm
it would work well for the thing i showed i think
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
elle garbage collector creates more garbage than it cleans
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
at least its not j*va
You are forgetting kotlin also uses jvm
my face when kotlin native
My face when graalvm
Kotlin native is horrible
Not even you used it in aoc
hm
@valid jetty should carriage returns be illegal
in my lexer
theyre useless annoying and deprecated
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
windows users can <redacted>
thank u!
@valid jetty do u use f128
or f64
cause its unstable apparently
but idk if it actually affects native x86
wtf
So your "floats" are 256 bits?
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,
}
}
isnt that slower at runtime
i dont think so
cause ur dividing instead of storing a constant float
optimization does constant folding
hm ok
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
thanks vscode, i really need to download all of these
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;
should i use kotlin multiplatform for mobile app or flutter?
id give a shot to flutter given your app doesnt really need to be multiplatform
works for me
except the params stuff
but dont make it like rosie
just store floats as floats
rosie just didnt know that you can do stored d_5.4
can i somehow get the string as a list of characters and get their ascii codes
the input one
yes just do .input ?
no from the input
lets just say
const input = "static void idk()"
// Get input as array of ascii codes?
you could do [...input].map(ch => ch.charCodeAt(0))
btw any idea why the params arent working
like they work inside regex101
what
well im parsing it from some documentation source and kinda missed these guys
nvm fixed that
what
im lexing floats now
Are you flexing loats?
yes
flexing lats
@valid jetty @placid cape do i write voice assistant nlp in rust
it needs to run fast on embedded
Write voice assistant in brainfuck
so true
what do you want to use for speech to text?
write brainfuck interpreter in voice assistant
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
does someone know why am i getting overful hbox here?
https://x.com/satanacchio/status/1876690820155531775?s=46
*Laughs in Bun*
Node.js v23.6.0 is out! 🥳🎉
This release enables the flag --experimental-strip-types by default.
Node.js will execute TypeScript files without additional configuration!
⚠️ This feature is experimental, has limitations and is subject to change.
https://t.co/hIoTQz7B26
Please tell me that @cast syntax is a placeholder
No it's built-in function
Like in zig
There's also implicit casting but this one is explicit
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
Works poorly if types and expressions have different syntax though
Better to have cast<i32>(val) imo
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
kotlin actually has a nice feature that lets you safely cast anything
as?
does kotlin have transmute
idk what that is
lc.define transmute
<:i:1263592450136473684> transmute trɑːnzˈmjuːt
verb
- change in form, nature, or substance.
- the raw material of his experience was transmuted into stories
<:i:1263591098740113478>transmogrify
wing detected
there are a ton of type conversion functions
its like
that seems more like a js/js dynamic thing
imagine u have a struct with 4 1-byte chars, a transmute is an operation where you can turn that struct into a single 32 bit int
as an example
lc.g transmute programming
not really a core feature but its possible probably
i think kotlin may be too high level for something like that
we don't have structs for instance
oh
well i mean you can just have a function transute()
copies over the values to the new class
you can manually convert stuff yeah
@frosty obsidian
nono the transmute wouldnt work specifically for that its sort of like a reinterpet cast in C++ in a way
somewhat
oh
the 4 1-byte char struct is 32 bits in contiguous memory which is why you can transmute it to a 32 bit int
not low level enough
could maybe be implemented using JNI
well yeah but you aren't in kotlin at that point
