#πŸͺ…-progaming

1 messages Β· Page 19 of 1

austere idol
#

and why do you need that?

lavish frigate
#

thats the fun part!

#

you dont

austere idol
#

i knowd that!!!!

fleet cedar
#

I think the latter will require you to write struct Struct to refer to it

lavish frigate
#

*actual bonus points if you derive default though

lavish frigate
#

Why is c so weird

austere idol
#

mentality behind it is not understandable by us (esceptinally rust developers)

lavish frigate
dawn ledge
lavish frigate
#

I’m the oldest person on earth

lavish frigate
fleet cedar
# lavish frigate Why is c so weird

Probably 50 years ago writing struct Struct made it easier for compilers to parse, but then a decade later they decided this fucking sucks and made better compilers with typedefs

lavish frigate
#

LMAO???

#

why do you need the struct_t at the end tho

austere idol
#

that's similar to

struct Struct {
    int   a;
    char* b;
};

struct Struct Struct_create(int a, char* b) {
    struct Struct s = {a, b};
    return s;
}

(i know that there is shorter way to do that, but i forget it)

fleet cedar
lavish frigate
#

..?

#

ive made a couple small programs in C but im not very well versed in C

#

OH

#

its the name

#

im stupid

#

yeah okay

#

why put the name at the end tho..

austere idol
# lavish frigate ..?

if declared as a struct, you will write struct Struct
if declared as a anonymous struct with typedef, you can do struct_t (Struct) without struct

lavish frigate
#

ah

#

yeah okay now it makes sense to me

fleet cedar
#

int x; x is a variable of type int
typedef int x; x is an alias for type int

lavish frigate
fleet cedar
#

Typedef syntax gets much more fun with function types and pointers

lavish frigate
#

pointers 😨

fleet cedar
#

C'mon, you know you love it

lavish frigate
#

i mean yea kinda

#

pointers are kinda stupid yes but they are also fun to work with because i love challenges

#

figuring out how to make a dynamically sized array in c from scratch was fun

austere idol
deep mulch
#

@dawn ledge hii

fleet cedar
#

So you almost always do typedef void (*Function)(int, int); to get a function pointer type

dawn ledge
autumn sigil
#

anyone used the zig build system before? i dont understand why these dont produce the same exact output

#

first one makes file thats 3.5kib second one makes a file thats 2 megabytes

#

so clearly the second one isnt being dynamically linked against the system library right? i dont know what im doing wrong :(

autumn sigil
#

it doesnt link the same at all

#

wait is that the output for the linking of the buildscript? what is going on 😡

dawn ledge
#

zig moment

frosty obsidian
#

@deep mulch help

#

im encountering the weirdest thing

#

a variable is null but somehow returning false if you do == null

#

and its only happening in one place

deep mulch
#

wing

frosty obsidian
#

and only in a release build

deep mulch
#

show

royal nymph
#

show code

deep mulch
#

wing forgor

frosty obsidian
#
fun Navigator.navigate(screen: Screen) {
    println(parent)
    if (items.any { it.key == screen.key }) return
    if (parent == null) {
        println("has no parent")
        runCatching { push(screen) }
        return
    }
    else runCatching { parent!!.navigate(screen) }
}
deep mulch
#

wheres parent defined

frosty obsidian
#

Navigator

deep mulch
#

show

frosty obsidian
#

its just a val on the naviagtor that defaults to null

deep mulch
#

if its only release maybe proguard is removing something during minification

frosty obsidian
#

its not

#

because it works properly in an identicle component on the same screen

deep mulch
#

println(parent) prints null when parent == null returns false?

frosty obsidian
#

yes

#

the first print statement prints null but the second print statement is never reached

deep mulch
#

interesting

#

is parent a mutable state

frosty obsidian
#

nop

#

regular val

deep mulch
#

weird

#

have you tried debugger

#

or that wouldnt be possible cause its release build only

frosty obsidian
#

yeah

#

note that i use the same component for each of those

deep mulch
#

does parent get set to null anywhere in the navigator ro somewhere else

frosty obsidian
#

nop

#

its the root navigator

deep mulch
#

try ```kt
if (parent == null) {
println("has no parent")
runCatching { push(screen) }
return
} else {
println(parent)
runCatching { parent!!.navigate(screen)
}

#

see if its null when it prints there

frosty obsidian
#

i know it is

#

bc before i added runcatching it would crash

deep mulch
frosty obsidian
#

the same component

deep mulch
#

maybe youre forgetting something in the component

#

oor maybe

#

where does parent get assigned

royal nymph
#

are u sure it's not just this

frosty obsidian
#

yes

royal nymph
#

anyway that code is kinda meh anyway cause u keep referencing the same thing

#
fun Navigator.navigate(screen: Screen) {
    if (items.any { it.key == screen.key }) return
    val p = parent
    if (p == null) {
        println("has no parent")
        runCatching { push(screen) }
        return
    }
    else runCatching { p.navigate(screen) }
}
#

do

dawn ledge
#

not the minification

frosty obsidian
#

parent is already a val

deep mulch
frosty obsidian
#

it cant be changed

royal nymph
frosty obsidian
#

yes

royal nymph
#

then your issue shouldnt happen

frosty obsidian
#

i checked source

royal nymph
#

are u sure parent doesnt change

#

it has to change

#

that's the only explanation

frosty obsidian
#

nop

#

parent is a constructor param

#

its provided only when i create a new navigator

#

which i dont do here

deep mulch
#

do if (parent.also { println(it) } == null)

#

since thats the closet it can get

#

i think

#

in case somehow its getting set to a value in the time between function calls

#

compose snapshot system might be related

frosty obsidian
#

unless the library is using reflection it shouldnt change

#

i added anyways

frosty obsidian
#

none of this really explains why its only happening on this component and in a release build

deep mulch
#

try minifyEnabled = false anyways

frosty obsidian
#

even if that works its a terrible solution

deep mulch
#

i know

#

but just try it

#

narrow down the issue

#

if thats the issue then we can figure out rules for proguard

frosty obsidian
#

why did it have to be weird on release build

#

so long to compile

deep mulch
#

oyu love

#

is it still not done @frosty obsidian

frosty obsidian
#

i had to make tiny adjustment

deep mulch
#

oh

frosty obsidian
#

oh weird it was that duplicate key check

#

but that shouldn't happen either

deep mulch
#

whar

frosty obsidian
#

the account settings screens key shouldn't be being used twice

#

now that could be minification causing two screens to have the same qualified name

deep mulch
#

maybe

frosty obsidian
#

which is what voyager uses for keys

deep mulch
#

does changing it fix

frosty obsidian
#

testing now

#

if thats the case then i could just override the key

deep mulch
#

maybe

frosty obsidian
#

that would explain why its that specific screen and only in a release build

#

although still no clue how proguard gave two classes the same qualified name

#

what if its compose compiler messing up

#

actually i did bump agp to 8.6 recently

frosty obsidian
#

so minification is the cause

#

im gonna downgrade agp and see if that fixes it

deep mulch
#

i know everything

frosty obsidian
#

this is still an odd issue

deep mulch
#

yes

frosty obsidian
#

i love agp breaking things

#

thats the only thing I've changed recently enough to cause the issue

deep mulch
#

maybe you can report

frosty obsidian
#

i probably will

deep mulch
#

youll need to make reproducer

frosty obsidian
#

guh nop

#

too lazy

deep mulch
#

theyll ask you for it

frosty obsidian
#

its also unlikely to be able to reproduce

#

i got unlucky

deep mulch
#

does 8.5 work

frosty obsidian
#

waiting for gradle sync

deep mulch
#

it will explode

frosty obsidian
deep mulch
#

guh

frosty obsidian
#

ill revert it even further to 8.1.4

deep mulch
#

what were you on before updating

frosty obsidian
#

8.1.4

frosty obsidian
#

but with a different name

deep mulch
#

interesting

autumn sigil
#

MAN FUCK ME

#

its not in release mode by default 😭

hushed pebble
#

womp

ornate quiver
#

chat is hibernation on luks a good idea
id need to suspend to disk
32gb of ram into swap

jade stone
ornate quiver
#

oh interesting

deep mulch
ornate quiver
#

kill

deep mulch
fleet cedar
#

Justified. Laptops are sacred.

hushed pebble
#

very

hushed pebble
#

and the performance impact won't matter much

ornate quiver
#

yeah im the kind of person to never close anything
although the laptop is very fast so i maybe ill just shutdown instead
my main concern isnt the performance so much as the wear on the ssd

cerulean plover
#

my desktop has 72gb swap on luks shiddohwell

cerulean plover
cerulean plover
#

for the times I theoretically hibernate my desktop

ornate quiver
#

never turn your desktop off

ornate quiver
cerulean plover
#

yop

ornate quiver
#

crazy

#

oh wait i just realized only used memory is written to disk
i dont think its gonna be big wear on ssd then

#

i thought it would encrypt and write 32gb to disk every time i hibernate

autumn sigil
#

just shut stuff off

#

blobcatcozy

ornate quiver
#

laaaazy

#

I never shut off my desktop

#

I finally got luks/lvm/mkinitcpio/uki to all collaborate
I can boot directly from uefi without any bootloader
@deep mulch are you proud

deep mulch
#

yop

#

my uki doesnt boot its just been using fallback image

#

too lazy to fix

ornate quiver
#

fix modules when

#

I disabled fallback
it made too many warnings on build

deep mulch
#

you will fix for me

ornate quiver
#

never
i got a headache because no way to turn down brightness from kernel console

deep mulch
#

love

cerulean plover
meager bobcat
ornate quiver
#

thank you so much

broken shore
topaz bolt
#

Can the github maintainers please add "plugin-submission" "plugin-fix" and some other reasonable labels for PRs cause it's kind of confusing otherwise imo

#

To differenciate between a PR that's a new plugin or just a fix of one or something else entierly

calm ruin
fleet cedar
#

Why

calm ruin
#

I used to keep laptop on to not wait modded minecraft launch again

#

its gpu died

#

well that was probably coincidence

jade stone
#

Part of me wants to use luks, but I don't want to type a password every time I boot

pseudo sierra
still jolt
#

I've gotten used to typing in a password on boot because of zfs

lavish frigate
supple vault
#

how do I make this return itself?

import { EventEmitter } from "events";

export default class RPCServer extends EventEmitter {
  constructor();
}
#

in action:

#

and the class im typing

#

nvm

#

I had a type overriding the module

lavish frigate
autumn sigil
#

worth it

jade stone
#

i am going to go fucking insane

#

thanks, i love it when my errors are caught by some random thing and not shown to me

keen galleon
#

you cant fetch external resources on localhost right?

jade stone
#

am i stupid

#

does typescript not have overloading?

austere idol
ornate quiver
#

ts is js with source typing

jade stone
dusty moth
ornate quiver
#

signature as in name?

stoic helm
#

in classes you can overload like ts class a() { function a(param: string): string function a(param: int): string function a(param: string | int): string { return param.toString() } }

dawn ledge
dawn ledge
lavish frigate
#

which one of you non rustacians was this

dawn ledge
#

love is unnecessary yes

final night
#

I have wasted 3 months trying to get love and I wish I just didn't want it now

umbral mirage
pastel mauve
#

its unnecessary and unexpected and unwanted but why do people desire it so badly ?

#

feeling wanted and having purpose is one of the main things people search for in life and being loved includes those

#

it hurts and it's emotional and stressful but it's also a really beautiful thing, and it's part of life so i believe you just let it bother you until you realize why it's so important :3

#

just realized this is programming lmao

#

sowwy

thorny prism
#

yo how do u add a run button for typescript files

#

in vscode

thorny prism
#

i switched to webstorm :)

lavish frigate
#

google dot IT????!!

lavish frigate
#

hope you can recover soon

thorny prism
#

yeah i will recover to c#

#

insane error solving?

thorny prism
#

result

tame vessel
#

Hi everyone, I'm trying to develop my first Vencord plugin, and I have a question, where should I look if I want to update my userPresence Status ?

dawn ledge
#

rpc

#

isnt there already a vencord plugin for presence

#

you can just look at that

tame vessel
#

Oh yes, thx steamhappy

thorny prism
#

okay @lavish frigate maybe ts isnt that bad cuz making a discord bot is 100 times easier in this 😭

lavish frigate
#

yop

thorny prism
#

now i gotta compile zed from source cuz im on windows :(

#

yeah this'll take a long time

brave burrow
#

Use scoop or download from here (which scoop uses)

thorny prism
#

oh okay thanks i didnt rlly search much for a build since the official guide told me to build it myself

elder scaffold
thorny prism
#

ig its ssupposed to be fast since its made in rust?

#

yo its like vscode just different

elder scaffold
#

neovim better

thorny prism
#

jetbrains better

#

zed is way to minimal lmao

#

imo

elder scaffold
#

eh i use intellij for java

thorny prism
#

i use webstorm for ts rn cuz ion feel like installing 2 million extensions into vscode to have an acceptable coding experience

still jolt
#

me who uses an lsp as an acceptable coding experience

#

unless it's java

elder scaffold
#

lsp so good

still jolt
#

sublime text so good

elder scaffold
#

what do I do in this position

still jolt
elder scaffold
#

wtf is sysrq

elder scaffold
still jolt
#

bedauerlich

lavish frigate
thorny prism
#

yeah ic

#

but uhh is there any way to make it so if you press a button, it makes a message in another channel, and if u press a button on that message it will give the original button presser a role?

tame vessel
#

Hi back, i'm tring to update a userPresence, using this code : ```ts
// Use LOCAL_ACTIVITY_UPDATE to update to the userPresence
FluxDispatcher.dispatch({
type: "LOCAL_ACTIVITY_UPDATE",
activity: {
state: "zZZzZZ...", // String
type: 4, // ActivityType: 4 = CUSTOM
flags: 1 << 0, // ActivityFlags: 1 << 0 = INSTANCE
},
socketId: "AutoCustomStatus"
});

What should I pass in my `activity` object? I don't find any documentation on that, and I don't want something with a rich presence like the customRPC plugin.
torn seal
quick crow
#

I'm not sure if you're talking about text status or rpc but just search for the flux type in sources, add a breakpoint and look at the args

frosty obsidian
dawn ledge
dawn ledge
frosty obsidian
dawn ledge
#

pretry much the same

frosty obsidian
dawn ledge
#

i am saying that "x is written in y so it must be fast" is flawed

winged mantle
#

can't you just install plugins to basically make vscode an ide for example

nimble bone
#

the text/code editor just edits files

#

IDE does debugging and all useful things in one place

nimble bone
#

its cursed

winged mantle
#

doesn't vscode support debugging and running

#

but don't most IDEs have all of their fancy functionality from plugins too lol

nimble bone
nimble bone
winged mantle
#

but from what I understand that is how IDEs work, you can just get specific packages which come with a ton of plugins

#

pluggers blobcatcozy

#

at least with Eclipse pretty sure Eclipse for Java Developers is basically just the Eclipse platform with Java Development plugins

#

eclipse rules

frosty obsidian
#

ides are just suped up code editors typically tailored to a language or ecosystem

#

they usually require little setup and include all the necessary tools out of the box

winged mantle
#

couldn't you just fork vscode and add plugins by default

#

then it would basically be an IDE

#

and doesn't vscode already come with plugins by default

dusty moth
#

iirc vscode is a typescript ide ootb

frosty obsidian
#

eh anything can be a ts ide

#

i don't really think plugins are what makes something an ide

winged mantle
#

but I thought IDEs were just a platform for plugins + a ton of plugins

frosty obsidian
#

anything can have plugins

winged mantle
#

vencord is an ide

frosty obsidian
#

vscode doesn't have a whole lot out of the box

#

they leave additional functionality up to the user

#

same as zed

deep mulch
#

@frosty obsidian i cant get the dumb thing to work on android

winged mantle
#

I guess vscode does not hold your hand a lot

#

there's no project wizard

deep mulch
#

every single time its 5 trillion duplicate classes

winged mantle
#

I wanted to make sublime text alternative so I don't have to pay

frosty obsidian
#

i think a funny way to tell if something is a text editor or ide is if it has a command pallet

winged mantle
#

vscode has command palette

#

I actually implemented command palette in minecraft before in cursed mod

frosty obsidian
#

i don't think any of the jetbrains ides have a command pallet

winged mantle
#

pretty sure they do

frosty obsidian
#

zed has one

winged mantle
#

yeah it's double shift

deep mulch
frosty obsidian
#

im not seeing anything about a command palette

#

googling just reveals people that want one to be added

#

double shift isn't a command pallet

#

its search

#

oh nvm

#

missed it

winged mantle
#

πŸ—Ώ

dawn ledge
# winged mantle I think it's pretty hard to say what is a text editor and what is an IDE

no its not
a text editor lets you just edit text nothing fancy, maybe some rich text, such as ms word, goog docs, etc
a code editor is the same as a text editor but more tailored for code with like syntax highlighing and all, such as zed, vscode, and the 50 other vscode reskins
an ide is what shitbrains makes, software completely tailored for just one language or framework

dawn ledge
dawn ledge
frosty obsidian
dawn ledge
#

(i was scrolled up lol)

winged mantle
#

I think the most ambigious thing would be that vscode sort of feels like a typescript IDE...

#

even if it's not super integrated...

#

I guess with virtually everything given enough people there will be different opinions

#

i might be talking nonsense as always

#

i think i would agree with your definitions but with vscode the line does feel blurry to me

nimble bone
#

yeah

#

same with nvim

dusty moth
frosty obsidian
#

no its double shift

dusty moth
#

like ctrl+n is new window search for classes

frosty obsidian
#

you can just type / to do commands

hushed pebble
autumn sigil
#

to me nano is a text editor

hushed pebble
#

exactly

#

it is

jade stone
#

what is the difference bewteen these in typescript

#
function func1(a: Type1 | undefinied, b: number){
return;
}
function func2(a?: Type1, b: number) {
return; 
}
royal nymph
#

well the second isn't valid

#

? means the argument is optional, aka you don't need to pass it

#

| undefined means the argument type also can be undefined, but you still have to pass it

ornate quiver
#

doesnt the optional params have to best last

viscid grove
#

is trying to patch this stupid?

#

i don't even know how to replace something here though

#

also i don't even think that's the place i'd need to patch anymore

#

this code is so confusing

dawn ledge
fleet cedar
#

Is ed a text editor?

dawn ledge
fleet cedar
#

A text editor is a program designed for editing text files. Msword is not a text editor, since it's meant to edit rich documents, not plain text

dawn ledge
#

im gonna kill

#

in this day and age every toher text editor supports rich text
unless youre on notepad

fleet cedar
dawn ledge
fleet cedar
#

You do know the difference between rich text and syntax highlighting, right?

dawn ledge
#

yes i do

#

i clearly stated syntax highlighing is a feature of code editors not text editors

fleet cedar
#

I'd hazard to say there are very few text editors that are not code editors (notepad being one of the few), since few people who aren't programmers deal with plain text files

thorny prism
#

how are yall still arguing abt this 😭

fleet cedar
#

Arguing is what this channel is for isn't it

dawn ledge
#

i never said text editors are code editors tho 😭

thorny prism
#

does someone know how u can like get the original guy who pressed a discord button between interactions

lavish frigate
#

a text editor lets me quickly put together words using characters from the following table:

#

while code editors let me inscribe runes into the magic rocks powering my computer

fleet cedar
#

21-bit character sets represent

glossy cloakBOT
#

mods crush this person's skull

elder yarrowBOT
dawn ledge
#

rip kyu

fleet cedar
#

Point taken, I'll stick to primarily ascii

lavish frigate
#

and thats why ASCII wins

keen estuary
#

How do i make a good discord client?

dawn ledge
#

you dont

tame vessel
#

Hey, yesterday I tried to create a plugin that allows updating userPresence (only the text status). I asked here how I should "update" this status, and you suggested I check the customRPC plugin, which I did. But after some research, I realized that RPC and TextStatus are completely different. I can't continue using the CustomRPC plugin as an example...
Is there an existing way to update the status?

drifting cloak
#

rule eleven?

formal belfry
keen estuary
formal belfry
#

GRRRR

lavish frigate
#

users can already change their status cant they?

void leaf
tame vessel
#

Yep of course they can, I just want to make a status that can switch between a day/night status lol

formal belfry
tame vessel
winged mantle
#

yes what else is it 6 bits

formal belfry
mellow phoenix
viscid grove
#

ik
it's prettified by default

#

but undoing it made the regex easier

#

well not really the regex but the find

serene elk
#

at one point you write regex without unprettfiying it lol

#

you just know what's different

fleet cedar
#

It's just deleting the artificial whitespace pretty much

serene elk
#

yeah

#

you are right

fleet cedar
#

I always am

thorny prism
#

okay so i made this ts code but it wont run on my linux device

serene elk
#

literally listen to the error lol

#

it's telling u what to do

thorny prism
#

im too stupid to do that

#

w8

elder scaffold
#

wait you can import json files?

#

thats cool

serene elk
#

if u can't fix errors showing to u what to do how are you gonna fix errors which don't actually throw errors

elder scaffold
thorny prism
#

errors that dont throw erros are easier to understand imo

serene elk
#

u haven't had an issue where you need to mentally visualize and understand why it happens then

thorny prism
#

not in ts

#

in c# yeah

#

i think i fixed it

#

nvm

#

what is this

#

im littarly doing what stackoverflow ask me to

serene elk
#

what's your node version

#

the syntax changed

dawn ledge
#

2.5k lines of html element attribute data

thorny prism
#

oh its v18

#

forgot to apt update :(

serene elk
#

it should be assert instead of with

#

assert is old syntax, with is new

thorny prism
#

assert still didnt work and with neither

#

but ill update it so its the same as on my pc

dawn ledge
#

perhaps use a bundler that'll embed the json file in the build :^)

thorny prism
#

im new to this thing :(

dawn ledge
#

hop on esbuild

elder scaffold
#

esbuild so good

thorny prism
#

yeah but the problem is that the json file contains the discord token

dawn ledge
#

you should import it on runtime

#

nah .env sint required

#

dont import config via an import statrement

thorny prism
#

oh

dawn ledge
#

use fs read and json parse it

#

because realistically you'll end up with a bundler, and importing via an import statement; the bundler will just embed the file

thorny prism
#

what ide do u use for ts

elder scaffold
#

nvim

dawn ledge
#

nvim on top

thorny prism
#

oh

elder scaffold
#

if you want another electron app to take another 40% of your computer resources you can use vscode

dawn ledge
#

or if you have infinite ram you can use shitbrains

royal nymph
#

vscode doesn't even use many resources

#

it's way lighter than intellij and similar

thorny prism
#

i mean maybe not the best for ts but for other languages it is

royal nymph
thorny prism
#

i did

elder scaffold
#

also are you running tsnode in a npm script

#

why not just use tsc

thorny prism
#

idk what that is i used some template for discordx

dawn ledge
#

tsc slowwww

elder scaffold
royal nymph
#
thorny prism
#

i really dont understand why they didnt add types to js but just create a new language

dawn ledge
#

javascript so bad

#

ts is the only think making js bearable

elder scaffold
royal nymph
#

they did just add types to js

#

it's not a new language

fleet cedar
#

Javascript is a compilation target that browsers (and some other environments) run

fleet cedar
#

Typescript is a language for humans to write

dusty moth
#

start the file with // @ts-check

dawn ledge
#

ecmascript foundation was a mistake

thorny prism
#

node js is the downfall of programming ngl

dusty moth
#

then add /** @type {whatever} */ where appropriate

elder scaffold
#

or just use typescript directly

fleet cedar
#

Who the fuck would rather write /** @type {...} */ than : {whatever}

thorny prism
#

rust isnt bad but i think its like hella overhyped

elder scaffold
delicate groveBOT
#

Alright @elder scaffold, in 4 hours: a

dusty moth
thorny prism
#

how ppl feel when their terminal is build in rust (it is 0.001 ms faster)

fleet cedar
#

It's just a phase

royal nymph
thorny prism
#

idk who said i should use tsx but it works thx

fleet cedar
#

Make a compiler from ts to js-with-comments SKULL_SKELETON

dusty moth
#

i can't use tsx, so I use js for my react code

royal nymph
#

not tsx as in typescript jsx but tsx as in the script runner

dusty moth
#

oh

royal nymph
dusty moth
#

i also can't use tsx because it doesn't work

thorny prism
jade stone
dawn ledge
fleet cedar
dawn ledge
#

python types are fake

#

just like typescript

#

both js and python dont have types

serene elk
#

ts did a good job at least

#

python no

lavish frigate
#

didnt they want to do that on js

#

like add type hinting sytnax for ides or somethin idk

calm ruin
#

People should switch to java already

#

@dawn ledge do not

#

JVM better than node

dawn ledge
#

rust

#

and nah

calm ruin
#

It has use cases

dawn ledge
#

jvm is worse than node

calm ruin
#

I agree

calm ruin
dawn ledge
#

chat
today is the day

calm ruin
#

Photoshop

thorny prism
dawn ledge
#

no

thorny prism
lavish frigate
lavish frigate
#

py

thorny prism
#

uhhh

autumn sigil
#

i am so happy

royal nymph
#

nerd

autumn sigil
#

thanks

lavish frigate
#

whats that

autumn sigil
#

im rewriting erlpack in zig because i hate cpp native node

lavish frigate
#

πŸ˜΅β€πŸ’«

#

wondering what they moved to

#

rust?

#

py?

#

...cpp?

fleet cedar
#

Scratch

lavish frigate
#

interesting

distant silo
winged mantle
#

JDA is more actively maintained IIRC but I remember the API being a little weird

distant silo
#

Jda is really weird

#

I haven't used either in a bit tho so ymmv

winged mantle
#

the message api feels like "do you want to get the content, the raw content, the cooked content, the formatted content or the unformatted content"

lavish frigate
#

tf is the difference

atomic brook
distant silo
#

CompletableFutures are just so nice when working with discord bots lol

royal nymph
fleet cedar
royal nymph
#

so they switch to rust

dawn ledge
royal nymph
#

Go is purple, Rust is blue.

#

u can see the spikes in go cause gartbage collector running every 2 minutes

lavish frigate
lavish frigate
meager turret
#

funnicons

lavish frigate
#

funnicons

serene elk
#

so hard for me to differ them in that image

royal nymph
#

ur colourblind?

lavish frigate
royal nymph
serene elk
#

yes

#

could be better but yes

royal nymph
#

or this

serene elk
#

that's good

dawn ledge
#

better have them opposite on the color spectrum

royal nymph
#

i didnt make the graphs xd

#

it's discord's

dawn ledge
#

yeah dsicord doesnt give a fuck about a11y

royal nymph
elder scaffold
royal nymph
lavish frigate
dawn ledge
#

there isnt a gc in rust

#

in rust we trust

elder scaffold
meager turret
#

trole

dawn ledge
#

okay bro

lavish frigate
#

okay bro

#

question

#

why?

meager turret
#

maybe they just wanted to make a rust gc

lavish frigate
#

the motivation is apparently "In Servo we use bindings to the Spidermonkey Javascript engine. Since Javascript is a garbage collected language, the Rust representations of Javascript objects are also garbage collected."

autumn sigil
# lavish frigate oh?

i cant even use their package because it doesnt work on electron so i had to write my own implementation, im now rewriting that

delicate groveBOT
#

@elder scaffold, <t:1726660247:R>: a

dawn ledge
#

hello ts nerds

#

so i have this

interface Foo {
  ...
}

function bar<Q>(query: Q, arguments: Foo<Q>) { ... }

how do i make foo extendable
similar to how you can add custom intrinsic jsx elements

#

nvm figured it out

fleet cedar
#

Isn't custom intrinsic a contradiction?

dawn ledge
#

banger

dawn ledge
#

couldnt care enough

#

i am making a very thin wrapper over document.createElement

#

no vdom crap

dawn ledge
#

okay people

#

typescript is fucking with me

#

here's my MRE

#
function thing<
    A,
    F extends (arg: A) => string,
    S extends string,
    I extends F | S
>(init: I, ...args: I extends F ? [A] : (string | number)[]) {
    if (typeof init === "function") {
        // do some things
        return;
    }

    thing2(args);

    return;
}

function thing2(args: (string | number)[]) {
    // do some other things
}
deep mulch
#

hi

dawn ledge
#

why does it not narrow args as (string | number)[] when calling thing2

dawn ledge
#

it REFUSES to narrow down

deep mulch
#

typescript scares me

#

i never knew its syntax could do that

dawn ledge
#

i've written much more unreadable typescript type horrors

#

this is the simplest of all

royal nymph
dawn ledge
royal nymph
#

and why would it

#

yes you narrow I to just S but

#

that's not how ts works

deep mulch
#

i should make a language called John

royal nymph
#

it can't infer that

dawn ledge
#

because init (which is I) is not a function at thing2 and since args is I extends F ? [A] : (string | number)[] i well... atleast expect it to narrow

deep mulch
#

cant you just cast it to the type you need

royal nymph
#

honestly those generics are hell and you should rewrite it probably xD

dawn ledge
#

please

signal oakBOT
#
type FunctionType<A> = (arg: A) => string;
type InputType<I> = I extends FunctionType<any> ? [A] : (string | number)[];

function thing<A, F extends FunctionType<A>, S extends string, I extends F | S>(
  init: I,
  ...args: InputType<I>
): void {
  if (typeof init === "function") {
    // do some things
    return;
  }

  thing2(args as (string | number)[]); // Type assertion for clarity

  return;
}

function thing2(args: (string | number)[]): void {
  // do some other things
}

Explanation of Improvements:

  1. Type Aliases:

    • We introduce type aliases FunctionType and InputType to make the code more readable and easier to understand.
    • FunctionType represents the type of functions that take an argument of type A and return a string.
    • InputType uses conditional types to determine the expected type of args based on the type of init.
  2. Clearer Conditional Logic:

    • The conditional logic inside the thing function is now more concise and understandable. It checks if init is a function using typeof init === "function" directly, avoiding unnecessary type checks.
  3. Type Assertion:

    • We add a type assertion as (string | number)[] in the call to thing2 to explicitly tell the compiler that the args are of the expected type. This improves clarity and can help prevent potential type errors.

Benefits:

  • Improved readability: The code is more easily understood with the use of type aliases and concise logic.
  • Enhanced maintainability: The
dawn ledge
#
export function html<
    Q extends ElementNames | QueryWithData | string,
    P extends Record<string, any>,
    H extends HTMLComponent<P>,
    I extends H | Q
>(
    init: I,
    ...args: I extends H
        ? [P]
        : [Q, ...(AttributesForQuery<Q> | HTMLArgument)[]]
): Element {
    if (typeof init === "function") {
        // TODO
        return init(args[0]);
    }

    const element = create(init);
    applyArgs(element, args);

    return element;
}

this is my real code

deep mulch
#

is the ai right

#

idk if that works

dawn ledge
#

and HTMLComponent is just (props: P) => Element

#

(raw dom elements)

royal nymph
#

just cast

#

why overengineer

#

just cast to the proper type

deep mulch
#

so was i right

dawn ledge
#

:(

#

i wish ts types were good

royal nymph
#

they are good but

#

it can't infer it backwards like that

#

you need a cast in some way

deep mulch
#

@royal nymph would you rather only write java for the rest of your life or C++

royal nymph
#

imagine

dawn ledge
#

well im just gonna cast

royal nymph
#
if (typeof init === "function")
  return;

init = () => "lol";
#

to make what you want possible, it'd have to make the typeof check erase the Function type

#

but what if you want filter: string | Function

#

and then

if (typeof filter === "string")
  filter = s => s.includes(filter)
#

for that to work it can't erase Function from the type

#

just cast is what you want :p

deep mulch
#

@royal nymph can you help me with something

deep mulch
#

its with zsh

#

in my zshrc at the start i have ZPLUGINDIR=${ZPLUGINDIR:-${ZDOTDIR:-$HOME/.config/zsh}/plugins}

#

terminal opens fine and properly sets it

#

when i open terminal in vscode somehow its getting set to ~

royal nymph
deep mulch
#

guh help

#

it puts plugins dir in my home dir

royal nymph
#

that's weird tbh

#

idk why that happens

#

check terminal settings of vscode

royal nymph
#

maybe one of them has insane value somehow

deep mulch
#

ZDOTDIR is equal to home dir in vscode terminal and in external terminal its unset

#

evil

royal nymph
#

figure out why it happens

#

or remove ZDOTDIR

deep mulch
#

thats weird

#

duplicates

deep mulch
#

yop

lavish frigate
#

actual horror

#

every time i look at this channel after a while there is a new insane problem from some mentally insane developer

lavish frigate
#

react with its game changing features, now i dont have to type the extra -2 lines

#

(technically extra -5 but whatever)

dusty moth
#

also you can pass signals to other functions

hushed pebble
elder scaffold
dawn ledge
#

fym dawg, so youre telling my an editor with syntax highlighting and stuff is "closer to what people call a text editor" by your standards but it cant fucking edit rich text?

cerulean plover
#

okay, would the distinction of if the application saves the text buffer directly or if it saves it in a special format be enough to classify an editor as a "text editor" or a "word processor"

ornate quiver
#

does anyone else have issues with linux firefox & pipewire/pipewire-jack
changing the output sink just breaks the audio completely until i restart ff

#

nvm i had to install pipewire-pulse and enable the user service
seems to fix somehow

fleet cedar
#

Iirc I had to disable pipewire-pulse and stick to pipewire-alsa, because for some reason -pulse would switch the volume unit from decibel to useless percent

dawn ledge
#

@royal nymph did it without type casts :^)

#

this is so horrid

#

i think i'll just cast

ornate quiver
fleet cedar
#

That hasn't been any issue to me

formal belfry
feral zealot
#

// Utility function to simulate a delay (basically sleep)
const sleepDelay = (ms) => new Promise(resolve => setTimeout(resolve, ms));

// Main sleep function with combined features that i need to use
const sleep = async (
isSleeping = false, // Default value for isSleeping
messages = { // Default custom messages that i will use
awake: "You're still awake, lazy af person",
asleep: "Goodnight"
},
delay = 0 // delay before "Goodnight" message that i dont need
) => {
// Input validation for the isSleeping parameter (super nerdy)
if (typeof isSleeping !== "boolean") {
throw new Error("isSleeping must be a boolean value");
}

// If there's a delay and isSleeping is true, wait for the delay
if (isSleeping && delay > 0) {
    console.log("Going to sleep...You fogot how to parry, dodge.. Oh wait, wrong game.");
    await sleepDelay(delay);  // Wait for the specified delay (in milisecounds)
}

// Return the appropriate message based on the isSleeping state
return isSleeping ? messages.asleep : messages.awake;

};

// Usage examples
(async () => {
try {
console.log(await sleep(true)); // Outputs: Goodnight
console.log(await sleep(false)); // Outputs: You're still awake, you lazy af person.

    // Custom messages and delay.. ( who needs it, use it.)
    console.log(await sleep(true, { awake: "Still up, what now", asleep: "Sweet dreams,Drake is still behind your walls" }, 2000)); 
    // Waits for 2 seconds, then prints: Sweet dreams, Drake is still behind your walls

    // Testing with invalid input
    console.log(await sleep("yes"));  // Throws an error, duh.
} catch (error) {
    console.error(error.message);  // Handle input validation error of error even occures
}

})();
// And yes, this is literally a code about sleeping in javascript language.

red canopy
feral zealot
runic sundial
#

have i ever spoken

#

about how much i FUCKING HATE THE ASYNC KEYWORD

#

LIKE

#

?????

#

DONE BY WHAT

#

BY WHO

#

WHEN

red canopy
#

i dont think you like async

#

idk

#

could be wrong.

fleet cedar
#

Why do you not like async

fleet cedar
#

Async is great

lavish frigate
#

async in js makes a lot of sense ☹️

runic sundial
#

where does the work get done??

red canopy
#

im not smart enough to understand it so im safe!

runic sundial
feral zealot
dawn ledge
runic sundial
#

yes but that's just one potential implementation

lavish frigate
#
const sleep = (ms: number) => new Promise(resolve => setTimeout(resolve, ms));

console.log("test");
await sleep(1000);
console.log("this runs after a second")
feral zealot
#

no thanks

fleet cedar
#

It was not a question

feral zealot
#

ill go with the other one

runic sundial
#

it just feels like such a bastardised way of thinking

#

the usecase makes sense

lavish frigate
#

shuddup i love my red/blue functions

fleet cedar
#

I hate function colors

#

Call them what they are

runic sundial
fleet cedar
#

||Monads||

runic sundial
#

red function

#

blue function

#

green function

feral zealot
#

ShiggySad Nu huh, I'n done being nerdy, im going to the fucking shadow realm

lavish frigate
#

πŸ”₯

#

instantly love everyone who calls js shit

feral zealot
royal nymph
#

it makes sense

#

you also do it irl

#

when you're coooking something and it has to boil for 20 minutes do you just stand next to it and wait or do you suspend the cooking and go do something else, then come back once it's time

lavish frigate
#

You are supposed to wait and watch smh

#

Or do you endanger yourself and burn your house down smh

fleet cedar
#

But a boiled pot never boils

#

...Err, I mean watched

runic sundial
#

The actions are independent. Time is passing and the cooking happens as 'time passes'

#

While in programming, that 'async' work needs to be done by something

#

It's closer to cooking food, and yelling at your brother in the living room who's watching TV to take out the trash

fleet cedar
#

Yes, the async stuff is being done by something (usually the os, or the browser in case of js), but the point is, you can do other things in the meantime

runic sundial
#

My issue is that it is implicit

fleet cedar
#

Most other languages require explicitly tokio::spawn()ing it or similar, yeah

#

If that's what you mean

royal nymph
#

it's explicit

runic sundial
#

ok, where do the async tasks get done?

royal nymph
#

you mark the function as async capable and explicitly suspend by using the await keyword

#

by the OS wires do you want to write assembly code to interact with the OS

fleet cedar
#

Where does the reading "happen" if you call .read() synchronously?

runic sundial
#

No, I want to know that there's a thread somewhere which will do these tasks. A thread that I own.

royal nymph
#

but that's not how async js works

fleet cedar
#

Js doesn't have threads

royal nymph
#

there are no threads

#

it's one single thread

runic sundial
#

so then it's time sharing?

royal nymph
#

async is not multi threading

fleet cedar
#

It's handled by the same event loop that dispatches click events and setInterval

royal nymph
#

async is allowing you to do something else while you wait for completion of an external source

fleet cedar
#

Is onClick unacceptable levels of magic?

royal nymph
#

if you block the process, e.g. via infinite loop, your async things will never unsuspend because the event loop is stuck

fleet cedar
#

In which case browser might pop up a message about "script is making the page slow, wanna kill it?"

runic sundial
#

then why the fuck is it called async

fleet cedar
#

Because async programming is the ability to do things faux-simultaneously

runic sundial
#

if what im reading is correct, it's just "Take this task, schedule it to be done some time later"

#

Makes sense for web requests

fleet cedar
#

Or rather, the ability to do other things while waiting

cerulean plover
#

How stupid is it to write a small program that reads some variables from files and parses them, mounts drives, copies something from one filesystem to another while doing a checksum of it, then does some stuff with that file which is really a disk image and mounts it using a loop device, and then mounts an overlayfs of that being the lower and some tmpfs being the upper

in Java or Node?

#

tl;dr: I want to write an initramfs script in a stupidly overcomplicated for the task language

cerulean plover
#

There is one half of me wanting to do this ironically and the other half wants to do it unironically

#

my soul does know I should use another language though

#

@nimble bone LET ME MAKE NODEOS OR JAVAOS LIVE INSTALLATION DISK INITRAMFS

nimble bone
#

make in node then

cerulean plover
#

how much more worse can you get than a bash script

#

@nimble bone i will make 400mb UKI

#

could I make something that wastes storage more than the average node_modules folder just for a fucking system to copy a filesystem to ram and boot into it?

#

ofc i can

runic sundial
#

you and your glass pane are no match for me and my item frame

#

nerd

cerulean plover
#

you will live in a hopper chain in a sorting machine

deep mulch
deep mulch
#

@formal belfry

formal belfry
#

huh

supple whale
#

btw why is vencord itself not in the vencord org, but on vendicated's profile?

#

some github pro shenanigans or?

serene elk
#

one reason is to give Ven visibility

#

If it was in the org it wouldn't be so directly tied to them

#

and also some org limitations I think

supple whale
#

any specifics?

#

i'm looking to move my project to an org

#

and idk if its a mistake or not

serene elk
#

I don't remember

#

@royal nymph is there actually any annoying org limitation?

royal nymph
#

i dont think so

ornate quiver
royal nymph
#

the one downside is that it is no longer attached with ur name

#

repo on your user account = wow you made this
org repo pinned to your account = is this guy piggy backing off some org project he made 1 commit to?

serene elk
#

yeah

#

it has a big difference in recognition

supple whale
#

yeah for me that's a good thing

#

my project is less than legal

#

so the less ties to me the better

dawn ledge
#

name the org after your username wires

dawn ledge
supple whale
#

sir I'm in too deep

#

shit has 3200000 downloads

royal nymph
#

do u mean miru

supple whale
#

XDDDD

dawn ledge
#

when is miru getting avistaz support

supple whale
dawn ledge
royal nymph
#

it's not illegal is it

#

like if it doesn't provide any pirated content itself

dawn ledge
royal nymph
#

it shouldnt be

supple whale
#

in theory it isn't

dawn ledge
#

yeah its not illegal perse imo

royal nymph
#

yeah but thats not ur fault xd

dawn ledge
#

its just a proxy

royal nymph
#

well obviously the use case is illegal stuff but

dawn ledge
#

makes doing illegal stuff easier :^)

royal nymph
#

the program itself does nothing illegal

supple whale
#

but in practice it incenticises piracy

royal nymph
#

just like how you can use torrent clients for only legal purposes

supple whale
#

which is illegal in many countries and I could get extradited to said countries

dawn ledge
royal nymph
dawn ledge
supple whale
#

qbit is generalized, so it gets away with it, mine is specifically targeted at anime media

serene elk
#

miru client modification coming soon

#

wait for it :)

dawn ledge
supple whale
#

it already supports full custom css

serene elk
#

DSFKDSJFDFDS

supple whale
#

and custom js extensions

serene elk
#

nothing is stopping me from hijacking your webpack

dawn ledge
#

does is support shiggy

supple whale
#

rest u can just pr to the project

supple whale
dawn ledge
supple whale
#

miru v6 is a vite webpack hybrid

#

so have fun lmfao

serene elk
#

it's funny cuz i've never even touched a webpack config

dawn ledge
#

i mean

#

just fork it

#

like migu

serene elk
#

I have no idea what settings produce the code I see

supple whale
dawn ledge
#

real

supple whale
#

because the author made it with ill intent

#

so I decided to also act with ill intent

serene elk
#

hehe

dawn ledge
serene elk
#

either way, that's a very neat project

#

my congrats

supple whale
dawn ledge
#

they killed aniwave miru is all i have

supple whale
#

I made my own code for it

#

and he's like, omg u steal code

#

lol no, that pr was broken as shit

#

didn't work at all

dawn ledge
#

broken
ujst like my code

supple whale
#

trust

#

I wrote so many libs for it while on vacation

dawn ledge
#

raaaaaaaaaaaaah

#

excited

supple whale
#

but I need to rewrite miru from scratch for the 6th time

#

for v6

dawn ledge
#

rewrite miru in RUST

supple whale
#

there's 0 benefits

dawn ledge
#

i'll skip school to work on rust miru

dawn ledge
supple whale
dawn ledge
#

wasm husk

supple whale
dawn ledge
#

i meant pure rust

supple whale
#

js is way better for this

dawn ledge
#

i hate that what you said is true

#

man i wish rust had good native gui crates

supple whale
#

I usually spit facts

dawn ledge
#

we will eventually have a rust miru

#

πŸ™

#

miru v20

supple whale
#

nope

#

we wont

dawn ledge
#

:(

supple whale
#

there are no good torrent libs for rust

dawn ledge
#

can always write one :^)

supple whale
#

webtorrent is like 70% of mirus functionality

dawn ledge
#

true

supple whale
#

there's no lib that comes close to how easy webtorrent is to build upon

dawn ledge
#

?remind me in 6 months rust web torrent lib

delicate groveBOT
#

Alright @dawn ledge, in 6 months: rust web torrent lib

supple whale
#

libtorrent is there, but it's insanely hard to work with and doesn't support webrtc

#

and miru os gonna be a website on a few years

#

so webrtc is needed

#

I'm working on making a live showroom for airing episodes with global twitch like chat

dawn ledge
#

wait webtorrent works on the browser?

supple whale
#

it's like 80% done

supple whale
supple whale
#

tcp and utp doesn't work

dawn ledge
#

ah

#

well then rewriting in rust isnt an option

supple whale
#

nope

dawn ledge
#

why bother maintaining a rust and web client when you can only do one

supple whale
#

anyways good night