#🪅-progaming
1 messages · Page 25 of 1
go switch makes fallthrough explicit
a LOT of fancy algos do that
Switch statements are slight syntax sugar for goto
i.e. instead of writing break you write fallthrough when you do want to fallthrough
Completely worthless in modern coding
switch foo {
case 1:
print("1")
case 2:
print("2")
fallthrough
case 3:
print("2 or 3")
}
this is go switch
my language has switch as a slightly different alias for match
so
How does that work
what ya'll meant to say
is switch statements suck
but insert unorthodox switch implementation here is good
aka that assigment sucks for normal switch
my language has switch_expr as a copy of match_expr with match changed to switch (and case is optionally accepted)
these kidn of statements make me want to spend the next 4 days tracking you down just so i can cut off ur balls
becaue people like you is why UE5 exists
unrelatedly, got an error
"yeah we dont need it, just use something slower thats simpler, throw more compute at it, it will fix itself"
You're forgetting that match is infinitely more powerful than switch can ever dream to be
Since it's pattern matching, not just constants
unless switch is just match in a trenchcoat (like java)
with different purpoe
as you said, switch is just goto
match isnt just goto
there's extra shit there
There are zero uses for switch that are not better handled by structured control flow
Other than legacy languages
that just means you havent worked with low level code which needs to be executed billions times per seconds where thoes uses matter
i'm not saying they are common
but switch has its place
and while I agree that match is often a better option for what programmers need
saying "match is better than switch" is like saying "just use salt its better than pepper"
no, they are different things
and i also fucking hate switch and always use some form of match
You can write the exact same control flow graph in better ways
switch is amazing for math, such as exponent functons etc
??
ex:
let expo = 0
swtich (order)
case 9:
expo += 1
case 8:
expo += 2
case 7:
expo += 7
case 6:
expo += 42
return expo
fallover has its uses
they are rare but they exist
i've also seen it a lot in networking hardware, because its simply fast for weridge non-standard shit
dis kinda a bad example cuz its performing the same math operation, but it could be doing other shit that'd need to be summed in order
its minor, but this is the shit that matters when you're transferring terabytes of data per second
I would have to compare the generated asm before I could say anything about that
fair
for match you'd need to put all the prev expressions in the next call, which means bigger jumps, which means slower
I'd try with something like ```
if order >= 9 { expo += 1 }
if order >= 8 { expo += 2 }
Any decent compiler should optimize that to the same
.
The body of the cases is irrelevant here
But I do admit that I typically work in fields where code quality is more important than squeezing cpu cycles
speaking of matches, how should I codegen them
should I convert rs match foo { Some(Some(a)) => 2 Some(None) => 1 None => 0 }tors if Some(_1) = foo { if Some(a) = _1 { 2 } else if None = _ { 1 } } else if None = _ { 0 } or would something else make more sense
If the patterns are disjoint, probably a jump table
ah, that makes sense ig
oh
and unflatten the matches?
What do you mean
i was about to submit a cool vencord plugin idea, are general plugin requests not allowed?
like rs match _1 { Some(Some(_2)) => _3 Some(None) => _4 None => _5 }tors match _1 { Some(_a) => match _a { Some(_2) => _3 None => _4 } None => _5 }until I add niches
Yeah sounds like a decent approach
Or patterns would complicate slightly maybe, but they're probably just a goto
maybe the wrong place to ask... sorry
or patterns would just be two gotos to the same place probably
let r = match foo {
1 | 2 => bar
_ => baz
}``````rs
jump_table!(foo) {
1 => 'a
2 => 'a
_ => 'b
}
'a:
goto 'c(bar)
'b:
goto 'c(baz)
'c(r):
/* ... */```
oh no what did I fuck up this time
Tree sitter?
using tree-sitter to procrastinate on actually writing the parser myself
Yeah I'm procrastinating mine too
I need to add parsing and serializing so I can compile my decompiled scripts back, but I'm stuck on figuring out exactly which subexpression each line number instruction belongs to :/
insane
did i never actually test multi-digit numbers properly
Eh, who uses those anyway
nvm they're getting bound as identifiers somehow
dark blue means it's an identifier getting bound somehow
what the fuck
\w does match digits, so maybe that's somehow
they're being matched as emojis
Why do you have emojis as syntactic constructs in your language
@analog sail
make quotes allow operators
my identifier regex is \p{XID_Start}\p{XID_Continue}* for textual identifiers and \p{Emoji} for emojis
wdym
syntactic nightmare
fn self + other {
}```compiles to a metatable
you can do something similar with metaprogramming
temp = ==
== = =
= = ==
allow that to happen
use swap_eq;``````rs
schema swap_eq {
fn preprocess(ast: SourceFile) -> SourceFile || Error {
ast.map_exprs(fn match {
.Assign(l, r) => Expression.Equal(l.cast(Expression), r)
.Equal(a, b) => Expression.Assign(a.try_cast(Pattern), b)
})
}
}```
how in the heck are you gonna parse this
"the = has no = behind it so it must be a declaration"
that's not up to me to figure out

i could pull a perl and not allow deterministic parsing
@nimble bone @nimble bone what sso do you use
authentik
why is the ↓ button just not
https://jsfiddle.net/PoolloverNathan/msnozpL7/12/
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
i could just make operators identifiers and make tree-sitter figure it out
hi, im here once again with react problem lol, i have a component, but this useeffect in the component gets run twice, i suppose this is again the same problem with the strict mode, but im not entirely sure when the problem could be in dev
have you considered not using react
the project is due tommorow >:3
just enough time to rewrite everything
show rest of component
including where setSupabase is called
supabase is not a usestate
what is it
call to createBrowserClient(...)
in what context?
export function EndMenu({ score, allChick }: EndMenuProps) {
const router = useRouter();
const supabase = createClient();
useEffect(() => {
async function updateScore() {
console.log('[CDS] Updating score...');
const user = await supabase.auth.getUser();
if (user.data.user) {
console.log('[CDS] User found:', user.data.user.id);
const resp = await supabase.from('leadeboard').insert({
"score": score,
"user_id": user.data.user?.id,
});
if (resp.error) {
console.error(resp.error);
}
}
}
updateScore();
}, [supabase]);
return (
<div>...</div>
);
}
heres the whole thing(stripped of stuff you dont need i suppose)
createClient(); calls createBrowserClient with few extra params
ah, you're creating the client in component context
hint: put a log inside createClient
mm i suppose wrapping it in usestate and remove the supabase dependency would fix the issue, but its not entirely correct, is it
Is anyone familiar with how chrome devtools' overriding content works? trying to make a change to some site's js file but pressing override content doesn't seem to do anything on the site
nvm it doesnt
the thing is, even if i leave it as [] and put createClient into useeffect block, it gets ran twice
usually it's initialized to null then properly initialized in a useEffect with []
wait, effects are run twice?
the fuck you doing discord?
i thought effects were explicitly not run twice
so would there be any way to prevent it running twice in dev?
Does anyone know why discord's useSpring makes some modals open in slowmo?
also how do I create a chrome extension that would patch the needed JS script when it's being loaded on a webpage? like what event should I look for and how do I determine when all the needed scripts have loaded?
just trying to create a simple patch that should simply turn false in one function to true
not really programming just some fun xd
i love when im trying to poke at a website and it does this to __REACT_DEVTOOLS_GLOBAL_HOOK__
they dont want people using react devtools
i already made an extension to bypass it
(cant use userscript)
hi everybody, i got a vencord plugin idea but idk if it's even possible so please tell me. Since the last attachment size limit change i'm constantly bothered by a popup asking me to get nitro if the file is >10MB, but would it be possible to make a plugin that tries to compress files over 10MB down to <10MB ? Since that's what I end up doing with third party tools I feel like there could be something to do here but i don't know enough about vencord and how it works to tell if it's even a good idea
zig server so based
I have tried ai code for small projects before, it's good if you rlly specify what you need
i had this policy in vendetta
i deleted any ai generated content
vee said no
whY
fair
i hate vee
I could see where they are coming from
like
"there are ppl here dedicating hours to this lang, and then there is you, the guy who thinks mr. ai will land you a job"
or I could be completely off
prob the latter one
cuz in the end, both humans and ai can write shit code, it's just that ai is more likely ig
int main() {
for (int i=10; i-->0;)
cout<<2*i+-+-+-+-1<<endl;
return 0;
}
quality
(i wrote this a while ago and found it lol)
i think you could go as bad as ```cpp
main() {
for (int i=10; i-->0;)
cout<<2*i+-+-+-+-1<<endl;
}
at this point this isn't even cpp anymore
that's valid cpp i think
with -Wno-all
Can i somehow get discord cdn shit in my app? It seems to have cors
Id like to just have gif in my app which is on discord cdn
no
discord cdn links have expiry arguments
they expire after 24 hours if no client fetches them
so i cant fetch gif into my app
not from discord
if you want a gif that’s always fetchable upload it to imgur or something
cause its erlpack
enable gateway log in discord developer settings (enable experiment plugin)
and it will log every message
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...
why cant i resize an image in css
.socialmediaicon{
width: 32px;
}
``` doesnt work
dont know much about css, but there might be a max/min width set
devtools?
yes 😭
ctrl + shift + i
it will tell you things like this
(not saying thats your issue here)
Lmao
mkdir --rate 😠
ok incredibly random question but are there any other packages that improve commonly used terminal commands
like zoxide for cd?
Eza, rg, bat
:3?
its slightly convoluted
but its cute
i think
it basically implements a builtin method called __fmt__ on all structs created in elle which produces this nice output
and then functions can choose to have structs diminish into a string via the @structfmt attribute
and if you want no fmt function on your struct for whatever reason you put the nofmt attribute on your struct
HOLY SHIT LMAO
IT WORKS WITH THINGS NOT CREATED IN ELLE
valibot is so nice
valibot very good
how does that work
also you should make it a regex environ
so you can set it to /v(e+\s*😭?)?\s*/i
i just let neon-env handle it
it's very similar to what I do
i just use valibot to parse process.env with with schema
env.ts: Lines 10-55
const configSchema = object({
PREFIXES: pipe(
string(),
transform(s => s.split(/ +/).filter(Boolean)),
array(string()),
minLength(1)
),
DISCORD_TOKEN: string(),
DATABASE_URL: string(),
NODE_ENV: optional(picklist(["development", "production"])),
GUILD_ID: string(),
COMMUNITY_CATEGORY_CHANNEL_ID: string(),
COMMUNITY_POST_PASS_ROLE_ID: string(),
DEV_CHANNEL_ID: string(),
SUPPORT_CHANNEL_ID: string(),
BOT_CHANNEL_ID: string(),
MOD_PERMS_ROLE_ID: string(),
MOD_ROLE_ID: string(),
MOD_LOG_CHANNEL_ID: string(),
MOD_MAIL_CHANNEL_ID: string(),
MOD_MAIL_LOG_CHANNEL_ID: string(),
MOD_MAIL_BAN_ROLE_ID: string(),
HTTP_SERVER_LISTEN_PORT: pipe(
string(),
transform(Number),
number()
),
HTTP_DOMAIN: string(),
GITHUB_PAT: string(),
GITHUB_CLIENT_ID: string(),
GITHUB_CLIENT_SECRET: string(),
CONTRIBUTOR_ROLE_ID: string(),
NINA_CHAT_TOKEN: optional(string()),
});
const parsed = mustParse("Invalid environment variables", configSchema, process.env);
guhhh what am i doing wrong
pull prop acces into variable so ts knows its number
can tsserver not infer if its not in a var
no, it doesnt know e is the same
i mean it does i guess, idk how to explain it
but no it just doesnt work like that
i think i will just as any
oh is this an enum
oh does filter even do result inference anymore i forgot
prob if the function asserts that the input is a number
too much zig lately
let intents: number[] = Object.values(GatewayIntentBits).filter(e => !isNaN(Number(e))) as number[];
it does now
if it constrains the input's type
T[].filter(fn: (x: T) => x is U): U[] (simplified)
does anyone remember when a guild becomes "large" (requiring an op 13 event to be sent to receive future events)?
was it 50 or 300 members or something
i thought it was 100
but the api will tell you if a guild is considered large
you shouldn't need to calculate that
oh right
who wouldve guessed that this code causes SO MANY ISSUES
global pub;
struct Node<T> {
void *next;
T data;
};
struct LinkedList<T> {
Node<T> *head;
};
fn LinkedList::new<T>() -> LinkedList<T> {
return LinkedList { head = nil };
}
fn LinkedList::add<T>(LinkedList<T> *self, T data) {
Node<T> *new = malloc(#size(Node<T>));
*new = malloc(#size(Node<T>));
if !new {
return;
}
new.data = data;
new.next = self.head;
self.head = new;
}
basically because Node is also generic it needs to also generate monomorphic definitions for that when making them for LinkedList
which it was doing on the parser level for structs that define it directly (some struct that defines a field like Node<i32> instead of Node<T>)
but in the compiler it was only doing the root struct, which is weird because???????? it was working before
i have been experiencing the worst form of torture a human can experience
my professor uses var for constants interchangeably and uses single quotes in js 😭
@royal nymph
imo single quotes arnet bad as long as youre consistent with it
@valid jetty
the other stuff should be banned though
doesnt it literally tell you "var is a deprecated keyword and breaks scoping rules. use let and const instead"
unless your profsssor uses a super old editor
vscode
it should tell you iirc
idk it doesn't tell me either
horror
maybe I need some extension
it should just be part of eslint
LOVE
singlequotes in js is sadly very common
people are insane
I only use single quotes if it's the language convention
I like double for string and single for stringly-typed enum
do I need to install eslint globally to use with vscode @valid jetty
Oops I shouldn’t be doing that?
Literally did a replace all on a multi thousand line project recently from double to single…
i mean it's purely preference xd
but I prefer double quotes because in other languages, single quotes stand for chars
double quotes = strings
single quotes = chars
yop
and imo double quotes look better
nah but i would do it anyway
makes it easier to run from the terminal
:3
vscode LSP when
https://vxtwitter.com/astrodotbuild/status/1856011142390513977 that’s pretty cool i guess
http://ikea.com now on Astro.
Heard it was as easy to build as my bookshelf 🇸🇪 https://t.co/fSFPINlTbt
though i’m honestly still not sure what so good about astro is
it's amazing
super nice DX
you can define your own fmt method now
my fucking rust code segfaulted
I actually never heard about it before browsing the source of vencord.dev, but it seems to be getting more popular
and I generally just can’t tell what the difference is between all the big js frameworks, like they all… look the same to me. how would i even choose one if i were to do some web dev
the compiler can do that
no the build output segfaulted
none
bad wrapper somewhere then
oh no
- before the name
is this like C pointer or something else
yes
- before the name because Array::new returns a pointer to Array<T>
technically pointer formats should be like
fn __ptr__::__fmt__<T>(T *self, i32 nesting) {
return string::format("<{} at {}>", *self.__fmt__(nesting), self);
}
but theyre more like
fn __ptr__::__fmt__(i64 self, i32 nesting) {
return string::as_string_wrapped(self);
}
atm
need to fix soon
it really depends on your needs
astro is really good for more static sites, although it does allow for more dynamic stuff
its also really good for documentation
starlight has been the best experience I've had making documentation
personally I hate that
I doubt you'll change it but if I could it would be before the type
*Array<i32>
wyd @valid jetty
being able to visualize arrays again after all this time
is so nice
that's good
yay

is this C semantics
where you only actually give the innermost type
not really
the main reasons you get a pointer instead of a struct directly are:
- to move it around youre only passing 8 bytes not 16 (size = 4, cap = 4, ptr = 8)
- methods can edit the array in place (otherwise youd have to do
Array<T> arr = arr.push(1)constantly)
TECHNICALLY elle automatically takes a pointer to the array when calling a method that requires self by reference instead of by value, however in cases such as you passing the array to another function by value, the argument will not have an address that you as the developer have access to, so you cannot call any of those methods that take a reference unless you create a new stack variable and set the array to it and then take the address of that instead
this totally isnt gonna be confusing for anyone righttttt
Rosie so smart
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED part 2
ELLE_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
what's an ElleMeta
its a this
runtime information about what the function is being called with and from where
does writing to types reinterpret?
no, types is just a static array of strings, the string is the type formatted as a string by the compiler
oh
thats how i get like these types here
wait what does variadic type the variable as
ik; what type does the variable end up being
like what's args's type
i64
technically it should be a va_list but its not
i64 is just like, a raw pointer
oh it's just a raw pointer?
yes
interesting
because this is all the compiler is doing
just allocates stack memory worth the size you specify and then calls vastart on that ptr
oh
its then a compiler gimmick but you can do args.yield(some type)
I made a script that adds the title of folders below each of them
function insertAfter(referenceNode, newNode) {
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}
let folders = Array.from(document.getElementsByClassName("folder_bc7085"))
document.querySelector('[aria-label="Servers"]').style = "text-align: center;";
folders.forEach(function(e){
const label = document.createElement("p");
label.innerHTML = e.parentElement.parentElement.parentElement.parentElement.getAttribute("data-dnd-name");
label.style = "color: white; font-size: 12px;"
insertAfter(e.parentElement.parentElement.parentElement.parentElement.parentElement, label)
// console.log(label, e.parentElement.parentElement.parentElement.parentElement.getAttribute("data-dnd-name"), e.parentElement.parentElement.parentElement.parentElement)
})```
can I make proxyLazy handle undefined properly?
this is the current result when factory returns undefined:
Uncaught TypeError: Reflect.get called on non-object
what would be handle properly
that
no
and I don't understand this use case
I mean, I'm using this for a lazy workaround for a complex situation
but I guess I need to resolve this the hard way
explain ur use case 😭
why does the error matter
ur code should never run into error
like I said it's kinda complex,
well I built the plugin loading system in you know what project so that first the plugin code is ran and then when preparation is done a plugin details object is returned but the thing is that some plugins want to use their own plugin details during initial execution and it doesn't exist yet at the time lol
so I thought that maybe adding a proxy lazy would make a workaround but this introduces more issues
I dont think using a proxy lazy to throw errors when its ran to early is a good solution
proxy lazy is more suited for when you need to return an object which is only going to be available later
like webpack finds
but not for errors
you can probably get it to work but there might be a better solution
yes a better solution is to first push the plugin details and then fill them as needed
but I didn't think of that a year ago
how exactly are details accessed
let's say for a "about me" site but with some fancy visuals. i'd like to create something similar to one of those sites from https://brutalistwebsites.com/
lazy.ts: Lines 63-76
/**
* Wraps the result of factory in a Proxy you can consume as if it wasn't lazy.
* On first property access, the factory is evaluated.
*
* IMPORTANT:
* Destructuring at top level is not supported for proxyLazy.
*
* @param factory Factory returning the result
* @param attempts How many times to try to evaluate the factory before giving up
* @param err The error message to throw when the factory fails
* @param primitiveErr The error message to throw when factory result is a primitive
* @returns Result of factory function
*/
export function proxyLazy<T = any>(factory: () => T, attempts = 5, err: string | (() => string) = `proxyLazy factory failed:\n${factory}`, primitiveErr = "proxyLazy called on a primitive value.", isChild = false): T {
PluginsHolder = {
// ...
get: function (name) {
return this.getAll().filter(x => x.name == name)[0] ?? this.getAll().filter(x => x.originalName == name)[0];
},
getAll: () => {
return window.GeneratedPlugins as AssembledPlugin[]; // idk why is this on window, don't remember
},
// ...
this is the Plugins.get and getAll
GeneratedPlugins is populated after completing of running the actual plugin code
you can just wrap it in a proxy which calls Reflect.get on {} if the receiver/target is undefined
you don’t need proxyLazy js has it as a feature itself
it would be perfect
then you could just throw in one of those
neat thanks! 
how the site looks is still just css
astro has support for preprocessors like scss though
some plugins check for the return value of get to check if the plugin is valid and proxied returns a proxy, so I guess forget the initial question
and also has support for mdx
damn
do plugins store the return value of get in a top level variable or something
and never call get again
not sure why to use scss either though. from what i've heard it essentially just simplifies some uhhh tasks you do with css (actually that sounds like a description suitable for any framework or something lol)
scss is very good
i'm no webdev guy 
i prefer it for more complex styling
theres also tailwind but that takes some getting used to
oh yeah i've heard of that one a lot recently
scss was useful when css didn't have all the bells and whistles it has today but now scss is just an unnecessary abstraction in most cases and can easily vomit out some horrible css
i like scss mixins
yeah some do that
const plugin = Plugins.get(config.name) // top level
but other one does this:
getInstalledPlugin (plugin) {
if (!plugin || typeof plugin.authorname != "string") return;
const iPlugin = SomethingSomething.Plugins.get(plugin.name);
if (iPlugin)
doSomethingWith(iPlugin)
and I didn't really notice anything wrong with the output
okay yeah
unless you change when details are set you are gonna need to use a proxy
as you can see if (iPlugin) will success even if the real result is undefined
and that introduces more issues
but that's what is going to happen once you use a proxy
yeah that's why trying to find some other solution right now
do you still want help with implementing the proxy lazy solution
nah it wouldn't really help, it was my first thought before I noticed other problems
this line (let mut db = ) segfaults
found the culprit I think
one of the blocks in this mf...
specifically checking if it's threadsafe lmao
and... creating a connection reaches that codepath unconditionally
does anyone know how webpack patches work? im trying to create a client mod for slack and im struggling.
this and the next few messages might help you understand it ig #🪅-progaming message
could someone tell me the cause of this? _cpu function symbol is defined in vmdef.h which has include guards, theres no reason to have this defined twice
What do you mean has include guards
Include guards don't prevent it from being included in multiple different compilation units
so how would i solve this then
main.c includes vmdecode.h which includes vmdef.h
ah i see
it's beautiful
java
getMutableSystemProperties
look inside
immutable
Peak gradle coding this is
RUST 
i cannot believe this shit
are you watching in browser bc youtube mobile app is bugged?
Hey @winged mantle A friend of mine wanted a plugin that also removes profile effects. I was wondering if you wanted to merge it as one plugin for themes and effects or I could just make a seperate plugin for it.
you can remove effects with css
i made the plugin because it was hard to do right with css
alright then
I just thought it was more ideal to implement it into one (noprofilethemes) then make others search for css?
wdym that’s mobile app
oh
why did it say Safari
oh wait it's < Safari
so ig you opened youtube from safari?
@livid light what do you wish to do?
msg me its lil private
Hemmliii
this is not dating channel
That is not what's going on gang
Which C library to draw simple text and pixels would yall recommend? raylib works, but is kinda uhhh
SDL exists
SDL is very popular
i read that as a weird spelling of onions at first
you gotta stop discriminating
Are you not quoting your strings when you debug-print them?
It looks like a debug print
why the hell are you storing it in an i32 pointer tho lmao
kinda misleading
specifically strings in formatting functions arent quoted
if you printed just a "string" it would be quoted
do you know what structs are
sorry that came out wrong
lmao
but basically when you allocate the memory for a struct you get back a pointer to the start of that segment, which is the first field
yes and it makes no sense to store a struct in an i32 pointer lol
in this case the first field is an i32
the Foo* in question
you do not get Foo* you get just Foo
Does that mean type Foo is pointer sized?
why lol
because that was meant to be a joke 😭
obviously you woudlnt actually do that in a real codebase
yopu can just foo.a or foo.b
Does type Foo mean a pointer to struct Foo?
but when you do this
use std/libc/io;
struct Foo {
i32 a;
string b;
};
fn main() {
Foo (2)foo = (1) Foo { a = 1, b = "hi" };
(6)io::cprintf("%d, %s\n", (4) foo.a, (5)foo.b);
}
the compiler does this essentially
export function w $main() {
@start
; (1) declare the foo struct
%struct.Foo.1720 =l alloc8 12
%offset.1721 =l add %struct.Foo.1720, 0
storew 1, %offset.1721
%offset.1723 =l add %struct.Foo.1720, 4
storel $.1722, %offset.1723
; (2) store it as a stack variable (when you do Foo foo = Foo {} it puts that struct into `foo` thats what this is)
%foo.addr.1724 =l alloc8 12
storel %struct.Foo.1720, %foo.addr.1724
; (3) load the struct back from `foo` (intermediate step)
%foo.1719 =l loadl %foo.addr.1724
; (4) load member a
%offset.1726 =l add %foo.1719, 0
%field.1727 =w loadw %offset.1726
; (5) load member b
%offset.1728 =l add %foo.1719, 4
%field.1729 =l loadl %offset.1728
; (6) print them
%tmp.1730 =w call $printf(l $.1725, ..., w %field.1727, l %field.1729)
ret 0
}
no it just means struct Foo
In that case casting a i32* to a Foo is nonsensical
not really
the way Foo is made is that it allocates memory of its size right, and what you pass around is a pointer to the start of that allocation
well the first field is an i32 so that pointer would be an i32*
Either a value of type Foo is a pointer, or it is not
it is a pointer internally, yes
but not a Foo *
specifically here
%struct.Foo.1720 =l alloc8 12
%offset.1721 =l add %struct.Foo.1720, 0
storew 1, %offset.1721
%offset.1723 =l add %struct.Foo.1720, 4
storel $.1722, %offset.1723
So then #size(Foo) is the size of a pointer?
uhh it is the size of the struct
when you put a struct into another struct it is memcpy'ed into it
that makes no sense
So it is not the size of a value of type Foo
you're saying Foo is a pointer, not a value, yet its size is not that of a pointer
yes
that is how structs work in C too
it is simply semantic that they are a value
So a local variable of type Foo is a pointer but a struct field of type Foo is the raw data?
you would never directly work with that pointer though
the compiler would automatically calculate offsets for you
yep
because getting a field from a local variable Foo is deref(fooptr + offset)
no i dont think so lol
in C, structs are values
getting a field frm a field of foo is deref(otherstructptr + fooptroffset + offsetintofoo)
semantically yes
Structs are passed by pointer in many ABIs
But the ABI is not exposed in language semantics
struct whatever {
int x;
};
struct whatever w1 = {0};
struct whatever w2 = w1;
w2.x = 42;
w1.x == w2.x; // false
it's a value not a pointer
How values are passed in the ABI does not leak into the language
in c when you make a struct and pass it around it passes a pointer to the start of the struct, allocates new memory in the other function, and copies the original struct's memory into it
so that when you use it it feels like its a value
so in the example you showed when you set w2 to w1 it actually allocates new memory and copies w1 into it
In most abis yes, because that's faster than copying the whole thing
^
But that is not part of the language
it doesnt matter what it does under the hood lol
it only matters what it is in usage
and that's a value
It does not allocate
It's on the stack
What happens under the hood is irrelevant
The language is the hood
stack allocation is still allocation
What matters is language semantics; compilers can then write whatever asm they want as long as all observable behavior matches those semantics
No
When you say allocate or allocation without qualifying, that means heap
and for the record you can do this thing in C too
just pointer arithmetic is done by element and structs are padded by default and stuff like that
Yes but then you cast the pointer to a pointer
so its a little bit more annoying
Which makes sense
true
i suppose that is something that i did wrong in the language on a semantic level
is this easy to read 🙏
im still kinda torn on whether <> is a good idea for concatenation
<> for string concat 
<> for monoid operator 
TRUE
i was gonna overload + and make it just use concat if its a string and add if its a number
however,,
this is a low level language
Js ptsd
sometimes if you wanna do pointer arithmetic manually for example
like if you wanna do str + 1 to get the 2nd char
Kinda nasty, but legit
you would expect the b not abcd1
How does memory management work with those strings?
well
thats essentially non existent lol
theyre null terminated
but any operation you do on them it creates a new string and leaks memory

That's not excellent
its not
a todo i have is to make it sized
technically you can work with it as sized by turning it into an Array<char>
there are apis in place to go from 1 to the other
im also torn on whether this is a good idea
But array<char> takes four times the memory
Array<T> is just size, cap, ptr, so 2 bytes
therefore 2 times the memory
not 4
how 4
wouldnt that be 3
2 bytes for the struct itself then 1 byte to store that char
A char is 21 bits, rounded up to 32
A char does not fit in one byte unless you're racist
in the case of elle chars are 1 byte
💩
also cstrings are not necessarily 1 byte thats just if you assume theyre utf8
(they are typically not)
Okay sure, if you want the null terminator it'd be two bytes
either way you can do this idk
and anyway this doesnt hold as the string size grows
its just a constant term
broke: i live in the hood
woke: i live in the javascript
you can also do this in C
int main() {
int x = 42;
*((char**) &x) = "lol";
}
doesnt mean it makes any sense
that would segfault if you try to use it tho
in the c code i provided it actually results in a working Foo struct
no it actually wont
well
it would print the pointer to the start of that string truncated to 32 bits
still not anything useful
What does from_string do with non-ascii?
what you would expect
I expect complete bullshit, if char is a u8
Meaning the char type is complete bullshit
i will make a c_char type u8 and then make a normal char type which is a u32
so that unicode still works
That sounds better
the reason its not always u32 is because sometimes you interact with padded structs from C libraries like raylib
if char was u32 it would calculate a completely wrong offset here
Using char for numeric values is already nonsense
no, actually
Yes please set my red value to {
in c people use char all the time to refer to 1 byte
because theres no explicit byte type
uint8_t
the point is that you can do anything with pointer casts so "you can do this thing here actually" is a meaningless statement
well what i did with pointer casts is just what the c compiler does under the hood to populate a struct so its not always meaningless
Except you're making it part of the hood
true,, but that was also kind of a joke originally,,,,
like youre not actually meant to do that to make a struct its just fun that you have the ability to do so if you wanted
i added 1 + 1,,,,
A bit clunky, but looks legit
what the fuck
Anyone who knows spring security here?
how do u fuckin read c code. i wanted to look at this method implementation which call i found in the code and i found NOTHING. and this func should definitely be in this repo judging from ff (fastfetch) prefix
Could be that the function name is spliced together by the preprocessor somewhere
Which is cursed
Or maybe that function actually doesn't exist and the code that calls it, which you're looking at here, is ifdeffed out
I’ve only found ffWinrtDetectMedia but uhhhh it’s missing another ff
also how do I make image rendering work in windows terminal 
need it for fastfetch
for loop through pixels and https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-setpixel

nah i mean from user perspective
i dont quite get what you mean
in some terminal emulators (kitty, iterm2, wezterm, etc.) there is support for cli apps to render images in terminal. yazi docs page (https://yazi-rs.github.io/docs/image-preview) says windows terminal (>= v1.22.2702.0) has support for it but it doesn’t work for me for some reason
How to preview images in Yazi.
ok i cloned the repo and opened it in clion and ctrl-clicking the func call redirects me to line 9
fucking macros 😩
i dont even wanna know why they dont wrap ff inside double quotes
this language is cursed icl
Macros w
please is there anyone whos knowledged enough in multiboot2
Why not just use linux
who actually uses windows in 2024 tho
a lot of people unfortunately
because it's actually usable
sure you can use linux, but it has more annoying problems than windows
eeeeeeeh
while i like using linux and i wish i could daily drive it, it's just too much of a pain because issues are too common
especially because stuff like nvidia
and also linux people are the champions to make 10 apps that do the same exact jobs except they all have flaws when they could unite and make 1 good software
in my experience linux is super reliable up until the point where you want to do something new
but i also did debian minimal and wiped windows cuz i'm a dumbass
not to mention is always heavily depends on distro
i mean i daily drived linux during 1.5y and i'm still alive
and some of the stuff i do on windows is linux heavy
like i mostly only use git bash because bash > cmd/powershell
most of the software i use is FOSS
like i use Gimp, LibreOffice, Firefox, etc
how do i submit quickcss code stuff
@programmers
grr
ignore my stupidity lmao
i'm bored and tryna make vesktop look more like the DC mobile app
i got the channel list looking identical
me unfortunately :(
I'm lazy, busy, switching to linux would make me never get anything done because I would be endlessly customizing everything, and some things I use like sharex don't work on linux
in #🎨-css-snippets ?
open a css ticket in #📩-modmail
thanks
clock :)
wait a sec that's more than 7 segments
3x5 pixel font defined by a u15 (zig)
that's so hard to read
why are they numbered
its a typographic clock - looks better when smaller / at a distance
now make it a quine
holy shit thats actually a great idea
in my experience it just werks 😶🌫️
How do I get accsss to #🧩-plugin-development
ask for permission through #📩-modmail
their is no option for accesss too plugin channel
pick the "i need to talk to a moderator" option
okay
skill issue
i added object files to elle
what is @volatile, the returntype?
no
@volatile is an attribute that basically says “don’t perform dead code elimination on this function and don’t optimize it, please just leave it alone” to the compiler
without that the function won’t be generated in the object because it’s not used anywhere
i did make that the default for generating object files specifically since that screenshot
when you pass -c:
- all public functions are exported
- it no longer expects an entry point
- the implicit string module methods are removed right before the IR is generated
- it generates .o instead of an executable by default
- creating generic functions or structs throws an error
static libraries are real now too i guess (i fixed linker flags)
this may be cleaner idk
i got rid of the -Dtime and -Clink-flag stuff because that was ugly
@valid jetty
hi
waow,,
ret is inferred then?
yes
if you return from multiple places it will throw an error if they dont all match
you can also specify an explicit return type
for recursive functions you kinda have to
otherwise the compiler wont be able to infer it
blobcatcozy
does this support tailrec
technically yeah sure
it wont optimize it for you but you can do it
use std/io;
fn sum(i32 x, i32 total) -> i32 {
if x == 0 {
return total;
} else {
return sum(x - 1, total + x);
}
}
fn main() {
io::dbg(sum(12, 0), sum(8, 0));
}
the traditional way
use std/io;
fn sum(i32 x) -> i32 {
if x == 0 {
return 0;
} else {
return x + sum(x - 1);
}
}
fn main() {
io::dbg(sum(12, 0), sum(8, 0));
}
note that elle has no default parameters so you must pass 0 as the initial total
i can actually even
use std/io;
fn tail_call_sum(i32 x, i32 total) -> i32 {
if x == 0 {
return total;
} else {
return tail_call_sum(x - 1, total + x);
}
}
fn traditional_sum(i32 x) -> i32 {
if x == 0 {
return 0;
} else {
return x + traditional_sum(x - 1);
}
}
fn main() {
io::assert(tail_call_sum(12, 0) == traditional_sum(12), nil);
io::assert(tail_call_sum(5, 0) == traditional_sum(5), nil);
io::println("The test has passed!".color("green").reset());
}
its not rust
.
I mean converting to a loop
otherwise it will stackoverflow
no but that is technically easy to do
i just need to convert function calls into a jmp to the start label and replace the parameters
wow
Make your lies believable next time
maple mono
it wont optimize it for
so it doesnt have it xd
silly banana
is it insane to edit nautlius source code for personal use to change it to use iec

That's pretty much the whole point of open source
is there a way to automate updates for a personal patch
it'd be cool if i could have automatic updates in general
there are a few ways most depend on what package manager you use
for arch you can use .patch files with PKGBUILDs
gentoo and nix also have a way to patch stuff but it's a bit more complicated
apt rpm etc idek
dnf
whatever imagine a cve in a file manager
would never happen
wait
i could use hooks
modifying os in the same way as video game haks

gzip still works fine too
oh yeah i was using zlib but i wanna switch ^^
i wonder why this doesn't work....
it doesnt look like theyre doing anything special to the buffers but ofc i dont have access to their node module src
wonder if they append some stuff
? it wants to read 3 bytes but there arent any more
decompile the android app
the decompressor is in java and isn't obfuscated
you will write a zstd inflater from scratch
might be fine if you dont impl dicts
why :c
private
youre mean
it looks like the single block i get doesnt have the last block flag set
so it tries to read more block headers and ofc it fails
now what do i do?
does that mean discords serverside impl is faulty?
it looks like i can reasonably expect a frame to have more than a single block so i cant just set the flag for every block..
setting the flag does spit out valid etf so 
wait nvm ofc it doesnt have the next block, its a stream
okay so i just finished the end of evangelion, what the actual fuck was that
wrobng chane
l
are you sure this is the right channel?
mb
xd
even wrong server huh
I love when I can't create a custom hook with svelte's runes
hate building from source
no patches in my house
hop on unstable-small 

LD_PRELOAD my beloved
replace the formatting function
I see
What formatting? Size? Date? Filename?
Is there a better way to see the lifetime of my code without having to run npm build and pnpm inject?
kp was du willst, sag mal auf deutsch
haha
ja ob ich immer discord neustarten muss
oder ob es nen dev build gibt. der live updatet oder sowas
kp
is "was du wilst" just what you will?
and does that mean wilst is "will"?
Just run pnpm watch
No need to reinject, it's already inside
Is it possible to create a fullscreen modal? So that you only see the servers on the left and I can do everything myself on the right. Like the SHOP tab, for example.
Check how the shop tab does it
is this approach good
let fecha = null;
let faltas = [];
for (let elem of doc.querySelector("tbody").querySelectorAll("tr")) {
if (elem.children[0].tagName == "TH") {
fecha = elem.children[0].innerText.trim();
continue;
}
faltas.push({
fecha,
...[
'hora',
'materia',
'tipo',
'motivo',
'comentario'
].reduce((a,b,i)=>(a[b]=elem.children[i].innerText.trim(),a), {})
})
};
It's functional but can be improved. Directly accessing child elements by index (elem.children[i]) is fragile. Use more descriptive selectors or a mapping to improve readability and robustness. Error handling (e.g., if a tr lacks expected children) is missing.
explain
Where can you look that up?
Use the search function in the dom
holy shit
@lone helm @ornate quiver WTF whatsapp web started using metro
cursed
so it's react native web ?
@calm ruin
probably 
lol yeah it is
you can tell if it's react native web by checking css classes
react native web makes individual classes for every single css property
cause react native uses metro xd
worse
facebook is so insane
I think twitter also uses react native
yet they use webpack
yeah
they've been using it for ages
maybe metro didn't exist back then
always has been
strencher tried to make a mod many years ago
not on android
wait i didn't backread enough
web is just regular react iirc
yea xd
css classes
and because it uses react native components like View and Text
is the ios app react native or something
bc otherwise i don't know why they would use that over regular react
insane
react native Web needs to die
what's so bad about it 
next time stop at react
react needs to die
it turns an already bad platform (react native) into somewhere it shouldn't run (web)
sooooo husk
.
it makes sense tho
the entire point of react native is write code once use everywhere
but in reality it doesn't really achieve that because normal react and react native use very different components and styling approach so you still have to write two separate ui implements
so the logical conclusion is to make react native run on web so you truly only have one single codebase
electron apps
i agree
enshittification of the web was spearheaded by them
return to jquery
whar
astro is supposed to be static rendering
there's no client side interaction
you have to byof
bruh i want to have 2 buttons which toggle rendering of 2 different components
imma just do it on a different page
youre solving the wrong problem with the wrong tool
normally i would have agreed and trashed on astro (or any other js framework fwiw)
but this is a you issue
its just a simple utility site, what other thing would you recommend? i didnt want to generate bloated nextjs project for such a simple site
its literally supposed to be 2 forms
lol
perhaps write a simple js snippet then?
if it is a simple site and youre looking for usestate somethings wrong
if you want a simple store theres nanostores
this guy has never heard of inline js..
elaborate
idk why i called it inline js
i just meant you need to get used to writing simple code if you want to use pure astro
and fwiw, its perfectly valid to have custom props on html elements
you can opt for data-foo pattern (and access it in js with elem.dataset.foo) or just elem.foo = thing
yep, already discovered that, but it will always be converted to string >:( so cant pass down functions

that's like saying your microwave isn't good because it can't cool food and they should add a fridge to it
if you want reactivity, use svelte
it was a joke cmon 😭
altough it mightve sound pretty seriously given the shit i wrote afterwards
astro is build framework + ssr adapter + static site generator
it is not an ui framework
that's why for anything with lots of reactivity you combine astro with a ui framework like svelte
astro is really great if all you want is reusable components
youre true, seems like i picked wrong tool for what i want, i guess ill keep using react 





