#🪅-progaming

1 messages · Page 92 of 1

strange matrix
#

@fleet cedar i have a question about importing libs

is it something that usually devs do that they bring the function from the libs they use and just include them in their own code
to like cut down size?

#

like

#

if i'm using printf from stdio

#

should i just copy that and put it in a separate file because maybe i'm not using anything else from stdio

fleet cedar
#

The benefit with using code by others is not having to write it yourself

#

For complicated things like printf, that's a pretty big benefit

#

Also yes, the resulting executable becomes smaller because the implementation is in a shared dll

median root
#

Does statically linking then put the whole binary in or just used functions?

strange matrix
#

uhhh

#

i was more asking

#

can i just steal printf from stdio.c

#

and keep a copy

#

so my statically linked exec doesn't become massive

fleet cedar
#

Sounds like a terrible idea but go ahead

strange matrix
#

cause i've seen

#

like

#

there was someone

#

doing a hobby project

#

making the smallest linux or something

#

its on youtube

#

i think they did something like that

#

and i was wondering how practical it is

fleet cedar
#

Copypasting functions makes your exe bigger, not smaller

spark tiger
#

why does this fucking shit show my full name there isob

fleet cedar
#

To be creepier than necessary

strange matrix
strange matrix
spark tiger
#

i'm good

#

ok doesnt seem to show it aynmore thnakfully

solemn ravine
#

@woven mesa I may get back to working on clipboard app after I get my location simulator thing working

#

because after that I inherently have nothing to do lol

#

apart from experiment with new things

#

and I feel a lot more experienced now than ever

solemn ravine
#

ikik scary

strange matrix
#

ahem
do not put your execvp() in a while(1) loop

#

lesson learned

fleet cedar
#

Eh, doesn't matter

strange matrix
#

not when my laptop hard crashes

fleet cedar
#

It'll still only be executed once

strange matrix
#

no its not

fleet cedar
#

Unless it fails

strange matrix
#

i had in one instance 1k instances of bash

fleet cedar
#

execve kills the current process and starts a new

strange matrix
#

wha

solemn ravine
strange matrix
#

look heres what happen

#

i do pkill blood (my prog name)

#

and then it started making bash shells

#

so

#

jus don't put execvp in while(1)

#

i just cpu bombed myself i guess

#

poor laptop from 2016

fleet cedar
#

That's not how execve works

#

Show code

strange matrix
#

oki

#

lemme

formal belfry
#

also, is there a way to hide specific guild tags?

strange matrix
#

right

#

right

#

you're correct

#

i just found out my mistake

#

but lemme show you nontheless

woven mesa
strange matrix
#
  while (1) {
    pid_t pid = fork();

    if (pid == -1) {
      perror("error");
      return;
    }

    execvp(comb_str, NULL);
  }

cancer code

fleet cedar
#

Well yeah forking is a different matter

lavish frigate
strange matrix
#

don't be mad at me im stoopid

fleet cedar
#

Why is whitespace a token

solemn ravine
#

you use coredata??????

lavish frigate
solemn ravine
#

since when

strange matrix
#

the seperator

fleet cedar
#

Because whitespace is not significant in most languages

#

The point of a lexer is to split into meaningful units

lavish frigate
#

hmm

strange matrix
#

right

lavish frigate
#

now that you mention it it is kinda smart to leave whitespace out

strange matrix
#

wait

#

WAIT

#

FORKBOMB

#

i forkbomb myself

#

that's why they call it a forkbomb

solemn ravine
strange matrix
#

holy crap

solemn ravine
#

in favor of a floating one like windows

strange matrix
#

+1 iq gained

solemn ravine
#

lc.i windows clipboard manager

visual shellBOT
solemn ravine
#

maybe something similar actually that's kinda ugly

#

eh whatever I take back what I said about removing the panel

lavish frigate
#

@fleet cedar ty actually i removed the whitespace token now my parser code is at least 10x more readable (yes i did just ignore whitespace tokens inside the parser)

#

the

if matches!(stream.peek(), Token::Whitespace) {
  stream.next();
}
woven mesa
#

i think its called grdb

hoary sluice
strange matrix
#

making a shell

#

more discouraged after forkbombing myself

lavish frigate
#

😭

strange matrix
#

👍

woven mesa
hoary sluice
#

then why does ur binary need to be statically linked and why does it need to be small

strange matrix
#

my brain

#

eh

#

dunno

woven mesa
hoary sluice
woven mesa
#

why would i want end users to install swift toolchain

hoary sluice
#

unpatched nix support blobcatcozy

fleet cedar
#

Why are you writing a shell in c of all things

strange matrix
#

i wanted to pick something up

#

and i don't know

#

learn something

hoary sluice
#

write a compiler

strange matrix
#

turns out

#

not a good idea

strange matrix
hoary sluice
#

new language

strange matrix
#

so do what pyro is doing ?

hoary sluice
#

whos pyro

strange matrix
#

pyra**

#

mb

hoary sluice
#

whos pyr

#

a

fleet cedar
hoary sluice
fleet cedar
#

Resurrect cobol

strange matrix
#

isn't cobol already being used

#

?

#

by banks

#

or like

hoary sluice
strange matrix
#

financial systems?

lavish frigate
#

im not writing a compiler i am writing a new shell i told u before 😭 but its gonna have a language "inspired" by rust

hoary sluice
lavish frigate
#

no

strange matrix
strange matrix
#

you just have basic shell funcs then

#

if i could figure out why execvp kills my original process

#

i feel like

#

i could make stuff way easier

#

for myself

fleet cedar
#

It replaces the current process with a different one

strange matrix
#

its yt time to see how people are running threads with C

lavish frigate
# lavish frigate no

its gonna be a mostly expression driven language, im thinking of a syntax similar to rust but like:

let something = (echo "test");

if something == "test" {
  git commit -m "a";
}

i think thats pretty cool

woven mesa
strange matrix
#

gerdub

#

what a name

strange matrix
#

oh no another rust video
part 27: Ownership is cool in rust

#

im

#

should i already just switch to rust? @fleet cedar

#

like am i torturing myself?

lavish frigate
#

we are all using rust here

fleet cedar
strange matrix
strange matrix
#

don't do that

#

absentee father what are you
just give me an answer

woven mesa
fleet cedar
#

I'm an internet stranger

lavish frigate
woven mesa
#

nooo

#

rust horror

#

swift is cute

strange matrix
#

swift has a massive list of dynamically linked libs

lavish frigate
#

swift is basically just apple flavoured rust

strange matrix
#

rust first-time compile takes 20 minutes to even wake up

woven mesa
#

swift is readable rust

lavish frigate
#

they have extremely similar syntax 😭

hoary sluice
#

at least a little

#

rust will throw you off otherwise

woven mesa
#

and also some of the naming conventions

strange matrix
#

so

strange matrix
#

i don't know i just feel like i'm weak not knowing how to make stuff work in C

lavish frigate
#

who gaf about c in 2025

hoary sluice
#

i probably cant either

#

u dont need to

#

but u should know what malloc does

shrewd canopy
hoary sluice
#

nothing is cute on windows

woven mesa
#

windows sucks ass tho

lavish frigate
#

swift is a pretty good lang i think it should also be used for apps on windows & linux maybe then native apps wouldnt be so painful

lavish frigate
#

I hope Microsoft tries to make another api for native apps and fails that would be really funny I think

shrewd canopy
#

Lol

hoary sluice
#

i hope microsoft files for bankruptcy

lavish frigate
#

Lmao!

hoary sluice
#

and its way more than 80%

woven mesa
#

99.99%

#

of all bacteria

lavish frigate
#

Linux isn’t even close to 80% what are you on 😭

woven mesa
#

yea true

hoary sluice
woven mesa
#

i cant think of a single game ive ran on linux

lavish frigate
#

There has been a huge push cuz of the steamdeck but it’s maybe 50%

fleet cedar
#

Yeah 98% isn't very close to 80%

hoary sluice
#

everything that doesnt have kernel ac works

woven mesa
#

anything that has kernel ac isnt a game

#

its a rootkit

hoary sluice
#

yop

#

so 100%

shrewd canopy
#

Bro is glazing linux too much

woven mesa
#

i prefer macos

#

my server runs macos

brisk baneBOT
#
                    'c.
                 ,xNMM.
               .OMMMMo
               OMMM0,
     .;loddo:' loolloddol;.
   cKMMMMMMMMMMNWMMMMMMMMMM0:
 .KMMMMMMMMMMMMMMMMMMMMMMMWd.
 XMMMMMMMMMMMMMMMMMMMMMMMX.
;MMMMMMMMMMMMMMMMMMMMMMMM:
:MMMMMMMMMMMMMMMMMMMMMMMM:
.MMMMMMMMMMMMMMMMMMMMMMMMX.
 kMMMMMMMMMMMMMMMMMMMMMMMMWd.
 .XMMMMMMMMMMMMMMMMMMMMMMMMMMk
  .XMMMMMMMMMMMMMMMMMMMMMMMMK.
    kMMMMMMMMMMMMMMMMMMMMMMd
     ;KMMMMMMMWXXWMMMMMMMk.
       .cooc,.    .,coo:.
lakhanlothiyi@Lakhans-Mac-mini.local 
------------------------------------ 
OS: macOS 14.6.1 23G93 x86_64 
Host: Macmini8,1 
Kernel: 23.6.0 
Uptime: 151 days, 20 hours, 47 mins 
Packages: 132 (brew) 
Shell: zsh 5.9 
Resolution: 1680x1050 
DE: Aqua 
WM: Quartz Compositor 
WM Theme: Blue (Dark) 
Terminal: WarpTerminal 
CPU: Intel i5-8500B (6) @ 3.00GHz 
GPU: Intel UHD Graphics 630 
Memory: 6262MiB / 8192MiB 

                        
                        



woven mesa
#

tf is using that much ram

hoary sluice
nimble bone
#

iutl if you have issues with linux gaming just play good games

fleet cedar
woven mesa
strange matrix
hoary sluice
#

if you have issues running valorant on linux, ask yourself why youre trying to run valorant

woven mesa
#

why do everyone play it

#

all my frens play it

hoary sluice
#

the only good shooter game is cs and guess what it works on linux

nimble bone
woven mesa
#

i hate bad mac software

hoary sluice
#

cant play fortnite on linux 😭 😭

woven mesa
#

me when i leave bad software running on my server mac

hoary sluice
#

mac server is crazy

woven mesa
woven mesa
#

its cozy

hoary sluice
#

i have played fortnite once, for 10 minutes

#

in season 1 i think

woven mesa
#

i only started in s3 or s4

fleet cedar
hoary sluice
#

yop

woven mesa
#

how long until epic releases mac releases of fortnite again

#

how did epic do anticheats on macos

pseudo sierra
#

according to protondb numbers there's somewhere between 15-25k games that do work on linux and only ~400 that are confirmed to not work so that 99% of games working is pretty accurate

woven mesa
pseudo sierra
#

and before you ask yes over half of the games that don't work are cuz of ac

woven mesa
#

they’re rootkits

#

so they dont count

woven mesa
#

spyware

hoary sluice
#

its very hard to make a game not work on linux

#

unless you add a flag that crashes if ran on linux

#

in every file

woven mesa
hoary sluice
#

does windows work on ia64

fleet cedar
pseudo sierra
woven mesa
hoary sluice
woven mesa
#

guhh

brisk baneBOT
#
Ayame Stats
Bot Started

<t:1748736387:R>

CPU Usage

0%

Memory Usage

1.5 MB

Swift Version

Swift 5.10

woven mesa
#

@hoary sluice

hoary sluice
#

if half the game relies on access to the windows kernel then its gonna be hard to just patch it out

woven mesa
#

fr

hoary sluice
#

1.5 MB is crazy

#

a barebones openbsd install uses 10

fleet cedar
hoary sluice
#

if ur game is written in ia-32 asm its not gonna work sorry

strange matrix
#

who

#

has coded in ia-32 asm

#

in their life

#

well actually nvm

#

beside some people

#

who has written a game in ia-32 asm

#
  // code below is from an llm + me. don't trust it

  if (pid < 0) {
    perror("fork failed");
    exit(EXIT_FAILURE);
  } else if (pid == 0) {
    char *args = {};
    execvp(bin_name, NULL);
    perror("execvp failed");
    exit(EXIT_FAILURE);
  } else {
    int status;
    waitpid(pid, &status, 0);
    printf("Child process finished with status %d\n", status);
  }
  return;

i've stooped low
i'm sorry

pseudo sierra
# hoary sluice what are the other half

scrolling through the top 1000 games on protondb it's basically all ac problems and the only one I've seen so far that wasn't was some funny problems with 32bit prefixes or smth but the last report was 3 years ago so it's probably been fixed sillycat

lavish frigate
strange matrix
#

y not use krita tho

#

feel like its good enough

#

@fleet cedar
how do i allocate memory for a substring if i don't know the length of it?
do i malloc and then realloc or ?
i wanna know what you'd do

fleet cedar
#

Find out length, then allocate

#

Or just allocate a bit too much

strange matrix
#

mm

#

okay

#

but i don't know length

lavish frigate
strange matrix
#

that's good enough for me

#

😭

lavish frigate
#

and krita is made to be good for drawing and paint.net is made to be simple

#

nothing compares to the speed at which i can edit stuff in paint.net

strange matrix
#

y not

#

uh

#

use wine for pdn

#

then

lavish frigate
#

it opens in less than a second, i have my image edit with simple tools and a simple ui and then i close the app

lavish frigate
#

there are some people trying to make something comparable for linux but of course it is still early

strange matrix
#

do you know y?

lavish frigate
#

...because wine doesnt support everything..?

#

it doesnt start up

strange matrix
#

i mean

#

more specific i was asking

lavish frigate
#

you can find that out yourself i do not use linux desktop

strange matrix
#

ohhh

#

i did nawt know dat

lavish frigate
#

i am on glorious windows

woven mesa
#

but yeah nvm

strange matrix
#

tsk

#

uses pro

woven mesa
#

yeah what about it

strange matrix
#

ltsc iot enterprise

woven mesa
#

no thanks

strange matrix
#

but y

#

it doesn't have the usual bloat

lavish frigate
#

why would i use ltsc iot enterprise

strange matrix
#

gives me access to some more stuff too

lavish frigate
#

i do not have the usual bloat

hoary sluice
strange matrix
woven mesa
#

who cares

lavish frigate
#

you cant value it until you try it

#

and as a linux user you cant try it so you are missing out

woven mesa
hoary sluice
lavish frigate
#

pdn isnt for drawing

hoary sluice
hoary sluice
lavish frigate
#

image editing

lavish frigate
hoary sluice
#

i never edit images either

hoary sluice
lavish frigate
strange matrix
#

y not use photopea*?

woven mesa
#

@hoary sluice fix

strange matrix
#

LMAO

lavish frigate
#

again

#

entirely different goals and target audiences

strange matrix
#

maybe i don't know what pdn is offering

lavish frigate
#

its so great because its native so its fast and its simple

hoary sluice
#

its like saying boo you cant play valorant without dualbooting

#

why would i want to

woven mesa
lavish frigate
#

absolute perfection

strange matrix
#

on da net

woven mesa
#

true

#

dotnet is funny

hoary sluice
#

either way gimp is better

strange matrix
hoary sluice
#

my what tool

#

like i said i dont draw

woven mesa
#

@lavish frigate

strange matrix
#

oh my god GIMP is so infuriating sometimes

fleet cedar
#

Imagine rectangles

strange matrix
hoary sluice
lavish frigate
#

you just cannot ragebait me lil bro

hoary sluice
#

try not to immediately prove my point challenge

strange matrix
hoary sluice
#

this is a 2018 nvidia issue

lavish frigate
#

right

strange matrix
#

tbh nvidia on windows is fucky wucky too

#

i have 2 monitors

#

i play 2 videos

#

one monitor instantly crashes

#

great drivers

lavish frigate
#

update yo damn drivers

strange matrix
#

i have the latest

#

my dear friend

#

what am i doing

#

i NEED TO SUBSTRING

lavish frigate
#

then something else is going on

strange matrix
#

ARGHH

lavish frigate
hoary sluice
fleet cedar
strange matrix
fleet cedar
#

Or build them yourself

strange matrix
lavish frigate
#

not a fan of char[]?

strange matrix
#

void bs_trim(char *str) {
  bs_trim_start(str);
  bs_trim_end(str);
}

void trim_start(char *str) {
  size_t start = 0;
  while (str[start] && isspace((unsigned char)str[start])) {
    start++;
  }

  if (start > 0) {
    size_t len = strlen(str);
    for (size_t i = 0; i <= len - start; i++) {
      str[i] = str[i + start];
    }
  }
}

void trim_end(char *str) {
  size_t len = strlen(str);
  while (len > 0 && isspace((unsigned char)str[len - 1])) {
    str[len - 1] = '\0';
    len--;
  }
}

void char_tokenize(char *str) {
  printf("{");
  for (size_t i = 0; i < strlen(str); i++) {
    printf("[%c]", str[i]);
  }
  printf("}\n");
}

strange matrix
#

i have shit against myself

#

i am the stoopid

#

okay?

#

language is perfect

#

(im coping)

hoary sluice
strange matrix
#

HOLY YES

#

ARGH

#

@fleet cedar i have made
substrings... kind of

look at my beauty

char *bs_splitargs(char *str) {
  char *substring = (char *)malloc(1024);
  size_t iter = 0;
  size_t len = strlen(str);
  while (iter < len) {
      if isspace(str[iter]) {
          break;
      }
      else {
          iter++;
      }
  }
  for (int i = 0; iter < len; i++) {
      substring[i] = str[iter];
      iter++;
  }
  return substring;
}

no llm involved here HAHA

woven mesa
unkempt ember
#

Genuine question : Why breaking the while loop instead of doing something like

while ( iter < len || !isspace(str[iter]) )
{
  iter++;
}

?

strange matrix
#

uhhhh

#

dunno

#

me stoopid :3

#

ty for telling me

#

i've had bad experiences with multi-rule loops in C#

#

so

#

yeah bad habits

unkempt ember
#

No problem ! I didn't know multi-rule loops were problematic in C#, what problem do they have ?

strange matrix
#

apparently sometimes

#

if one of the rules is true**

#

it doesn't check the next rule

#

or backwards

#

didn't matter if you used AND/OR

#

just was like that

#

me and a classmate were stuck on it for a while

#

eventually we just did nested loops

unkempt ember
#

What the - ?

strange matrix
#

oh my god it happened again

#

literally

#

okay so

#

i have this right?

  while (iter < len) {
      if isspace(str[iter]) {
          break;
      }
      else {
          iter++;
      }
  }
strange matrix
unkempt ember
#

That's my fault !

strange matrix
#

yeah i was slowly realizing 😭

#

man

#

y coding be awkward

unkempt ember
#

with || it continue even if you are out of bound because when iter >= len then !isspace(str[iter]) will be evaluated

strange matrix
#

yeah OR be like that

#

question

#

aside from

#

C

#

what was the hotkey to

#

uh

#

make text like this

unkempt ember
#

It's inline code : `Your text`

strange matrix
#

i know i know

#

what's the shortcut

#

like

#

Ctrl+B bold

#

Ctrl+I italic

unkempt ember
#

I don't know if there is one actually

hoary sluice
#

why is vencord gay again

fleet cedar
strange matrix
#

it has always been

unkempt ember
strange matrix
#

man i wish i wasn't one

fleet cedar
strange matrix
#

June 19 2009

#

how so

#

was it june or july

#

i forgor

fleet cedar
#

You said you are one, which os below 14

strange matrix
hoary sluice
strange matrix
#

i have to convert calenders

#

sure i can say

hoary sluice
#

from what calendar

strange matrix
#

28th Tir, 1388 HS

fleet cedar
#

I always confuse which is which of june and july too

strange matrix
strange matrix
#

so

#

june now

#

and

#

uhh

#

like

#

17th Khordad

#

so

#

20 more days

#

probably june yeah

#

19th of June 2009

#

i was born

hoary sluice
strange matrix
#

Hijri Ghamari (Moon)

#

Hijri Shamsi (Sun)

#

Saudi uses Moon

#

we use Sun

hoary sluice
#

whats the point of using a solar calendar that isnt gregorian

#

youre just making conversion confusing for no reason

#

whats the advantage of using solar hijri over lunar hijri

strange matrix
#

i have no idea

#

just tradition ig

#

we've been using dis shi since islam came

#

so

hoary sluice
strange matrix
#

days since

hoary sluice
#

unless persia started using solar immediately?

strange matrix
#

and ghamari would be

#

nights since

strange matrix
#

uhh

#

it was

#

Abu Bakr

#

that ordered invasion of persia

#

and then

#

he ded

#

Omar came

#

and then he took over persia

hoary sluice
#

in the 11th century ce

#

so like 500 years after

strange matrix
#

yeaj

#

i love strings

#

you know that

hoary sluice
#

oh they started using solar cause of agriculture

#

ok makes sense

strange matrix
#

look atp you know more than me about our calanders

hoary sluice
#

lol

strange matrix
#

i don't care i just need to conv this shi like daily

hoary sluice
#

why not just keep track of both dates

strange matrix
#

uh

#

my phone only does gregoryian

#

and i don't have patience to make waybar count for me

hoary sluice
strange matrix
#

no i generally don't have use for calender

#

i forget days daily

#

only to know that i have physics exam tmrw

hoary sluice
#

lol

strange matrix
#

YES

#

ohhhh

#

satisfaction

#

(i don't want to think about how i did this)

#

are you proud of me :3 ?
@fleet cedar

hoary sluice
#

now put ur code in an llm and ask it to scream at you

fleet cedar
#

Did you check for memleaks with valgrind?

strange matrix
strange matrix
woven mesa
#

gm chat

fleet cedar
woven mesa
fleet cedar
#

Sleep is not real

valid jetty
#

@hoary sluice i just had an insanity idea

#

generic functions can be hoisted right

strange matrix
valid jetty
#

because their body is defined at the point when you call them

#

because they need to be specialized

#

what if i

#

do that for every function

#

not just generic ones

#

qbe allows hoisting

#

and it would not only allow hoisting in elle but it would also act as dead code elimination directly

#

functions that arent called are never generated

fleet cedar
#

Which definition of hoisting? Js style?

valid jetty
#

no, just

#

calling a function before its definition

#
fn main() {
    foo();
}

fn foo() {
}
#

this currently doesnt work

#

requires forward declaring

fleet cedar
#

Oh, you mean thing that hadn't been a problem in any language developed the last 40 years

valid jetty
#

well

#

its not a problem in elle either if i make explicit return types

#

but i dont like that for prototyping

#

and this kinda solves it indirectly so

hoary sluice
#

can you not call non generic functions before theyre defined?

valid jetty
#

yes iirc

#

because theyre not immediately computed theyre kept somewhere to be specialized when you call them

#

actually idk but at the very least generic functions can call other generic functions before theyre defined

hoary sluice
valid jetty
#

ok but thats an interpreter

#

the problem makes sense in that world

hoary sluice
#

well no i could just push all expression statements to the end of the ast

valid jetty
# valid jetty and it would not only allow hoisting in elle but it would also act as dead code ...

benefits

  • dead code elimination
  • hoisting is good
  • compilation times will be faster

cons:

  • mutually recursive functions will probably stack overflow (though i can catch that i think)
  • this doesnt play nice with the lsp because its essentially lazily evaluating the bodies of functions, a function's body will only have lsp support when that function is called in reachable code, which obviously isnt ideal
#

idk how to approach the lsp problem, this is already a visible problem with generic functions

#

what if its not a problem

#

i can just do the rust thing of no lsp support unless that function is exposed in a crate

valid jetty
#

but rather than it being exposed in a crate its whether its called in visible code

valid jetty
#

you get nothing, not even autocomplete or hover support, nevertheless errors

#

its as if youre typing into a text file with syntax highlighting

fleet cedar
#

Ah yes, no diagnostics in files not part of the project

hoary sluice
#

@valid jetty i was trying to make readln and came to the conclusion that making io without monads or any types at all is stupid so now im watching typed lambda calculus videos

fleet cedar
#

Not sure what that has to do with declaration order

hoary sluice
valid jetty
valid jetty
#

there will never be any hover identifiers to check or errors

#

i could uhhhh

#

idea

nimble bone
#

Elle will bundle Grok to complete your code

valid jetty
#

if a function wasnt forced through reachable code

#

its just compiled after

#

with the same method of reachable calls

#

fuck this might need multiple passes

#
  1. compile main - the entrypoint, force functions as needed
  2. functions which werent forced are compiled seperately after, forcing any calls inside as needed
  3. repeat until no functions are left (???)
#

i dont quite know that much of the implementation details i would have to try it

pulsar elk
#

oop

#

wrong chat

valid jetty
#

it is june !!

hoary sluice
valid jetty
#

well technically yes but its very intertwined

hoary sluice
#

#[cfg(lsp)] or something for compiling unused functions?

valid jetty
#

even if it was completely seperate, unused functions being compiled out-of-order would cause the exact same error lol

#

i can do that for lsp only tho

hoary sluice
valid jetty
#

for lsp support

hoary sluice
#

since when does the lsp compile

valid jetty
#

the lsp goes through the whole codegen to find errors and hover stuff, just doesnt go as far as to generate any files

hoary sluice
#

oh

hoary sluice
valid jetty
#

with more information about the impl details, yes

hoary sluice
#

maybe if i watch enough videos on lambda calc i will eventually know formal math notation

valid jetty
#

do you not

hoary sluice
#

i never learned it

#

i dont know all the symbols

valid jetty
#

husk

hoary sluice
#

i just know the ones that i had to use or had to know the definition of somewhere

#

"if the sky is blue, then the sky is blue" https://en.wikipedia.org/wiki/Modus_ponens

In propositional logic, modus ponens (; MP), also known as modus ponendo ponens (from Latin 'mode that by affirming affirms'), implication elimination, or affirming the antecedent, is a deductive argument form and rule of inference. It can be summarized as "P implies Q. P is true. Therefore, Q must also be true."
Modus ponens is a mixed hypothet...

valid jetty
valid jetty
hoary sluice
#

horror to maintain

#

i wanna read from files

#

how do i read a file line by line

#
readLn filename line = -- builtin``` ???
#

this probably means i open the file a lot

#

or make it ugly and hacky

#

if its a monad i can do

file = fopen "filename"
readLn file
readLn file
readLn file
readLn file
readLn file
readLn file
readLn file
readLn file
valid jetty
#
fn main() -> Result<()> {
    let path = Path::new("foo.txt");
    let file = File::open(&path)?;
    let reader = BufReader::new(file);

    for line in reader.lines() {
        println!("{}", line?);
    }

    Ok(())
}
hoary sluice
#

ok now youve read a file in rust

#

wow

valid jetty
#

can values in icypeas not hold arbitrary values from rust?

hoary sluice
#

they can

#

well could

#

if i want them to

#

i can make Value::BufReader

valid jetty
#

then why cant a variable hold a BufReader and then you just call readLn on it

hoary sluice
#

thats literally just a monad but i stole it from rust instead of implementing it properly

valid jetty
#

well yeah i guess

hoary sluice
#

what if the user wants to make their own monad

valid jetty
#

tough

hoary sluice
#

they cant just edit the compiler

valid jetty
#

ok fair enough

hoary sluice
#

and this whole thing breaks down if i wanna compile

valid jetty
#

are you planinng to go further into it and add applicatives and functors and stuff

hoary sluice
#

im planning to make a type system and have everything else come for free

valid jetty
#

uhhh i dont think thats exactly how it works but sure

hoary sluice
#

ok it is

#

dont functors come for free

#

its literally just a function T -> U

fleet cedar
#

A functor is just a covariant generic type

hoary sluice
#

for free as in doesnt require changes to the interpreter

fleet cedar
#

(Technically doesn't have to be covariant but the abstraction is more useful with that constraint)

hoary sluice
fleet cedar
#

No?

#

Vec is a functor

hoary sluice
#

is a functor not a function of a category that returns another category

valid jetty
#

this statement has been living in my head rent free ever since you said it

#

idk why

#

it just has

hoary sluice
#

"Functors are structure-preserving maps between categories. They can be thought of as morphisms in the category of all (small) categories."

#

how is Vec a functor

valid jetty
fleet cedar
hoary sluice
#

Vec itself is an object

fleet cedar
hoary sluice
#

oh theres a difference between Vec and Vec<T>

lavish frigate
valid jetty
#

is this idiomatic??

gen.tree.iter()
  .filter_map(|stmt| match stmt {
      Primitive::Function(FunctionSource { name, .. }) => Some((name, stmt)),
      _ => None
  })
  .collect::<HashMap<_, _>>();
fleet cedar
#

Vec<T> is just a convenient way to refer to Vec applied to an unspecified type

hoary sluice
#

yes ok i get it

fleet cedar
#

Yep

#

Not [T]

strange matrix
hoary sluice
#

Vec is of type T -> U and Vec<T> is U if i understand it correctly

hoary sluice
fleet cedar
#

Haskell spells those kinds (that's what type-of-type is called) * -> * and *

#

Vec::new is completely unrelated though

#

Functors are fmap, not pure

valid jetty
#

have you guys ever used a multimap

hoary sluice
#

any function T -> Vec<T> is a Vec constructor

hoary sluice
fleet cedar
hoary sluice
#

which includes Vec::new if T is specified

hoary sluice
fleet cedar
#

Functor means any function A -> B can be mapped to a function f A -> f B

#

A -> f A is irrelevant

hoary sluice
#

i think i confused oop constructors and type constructors

#

i get it now

#

a functor needs a T -> f T and a f T -> f U

fleet cedar
#

No

#

Functor is only fmap

hoary sluice
#

well in a program you need a way to create f T

fleet cedar
#

Having A -> f A is called a pointed functor, but haskell just folds it into Applicative

fleet cedar
hoary sluice
#

ok

#

where did you learn all of this

fleet cedar
#

Haskell

valid jetty
#

are hashset difference operations fast??

#

my intuition tells me its O(n) where n is the length of hashset A

#

but im not sure

fleet cedar
#

In theory they can skip all the hashing stuff, but since rust hashmaps have different hashers per instance it's just essentially {x for x in a if x in b}

#

Still O(n) though, yes

valid jetty
#

i see

hoary sluice
#

@valid jetty ```hs
println "outside comment"
{- inside comment -}

-- inside comment

{-
inside comment
-}

{-
{- inside nested comment -}
-}

{-
{-
inside nested comment
-}
-}
println "outside comment"

#

try not to rip off haskell challenge

#

i can actually just use the haskell lsp

balmy lintel
#

who writes comments like that

fleet cedar
#

Being able to comment out a block is very useful

valid jetty
#

the neferious /* */

fleet cedar
#

Ever wanted to comment out part of your css?

lucid trail
#

I really like its match

valid jetty
#

what’s special about it

#

it’s just like any other match lol

#

@hoary sluice

#

(not my screenshot)

fleet cedar
#

The no-arg match seems like it could have uses

#

Very few though, else if is a thing

valid jetty
#

is that not exactly the same as rust ???? 😭

#

am i missing something

hoary sluice
hoary sluice
#

it looks bettes than an else if chain in languages that support it

#

like kotlin

#

in rust its

match () {
_ if ...
}
hoary sluice
hoary sluice
#

i want to eventually allow arbitrary operators, and // is way more likely to be used as an operator (probably will be built in floor division) than -- or {- -}, same goes for #, i want to use it in syntax and not waste it on being a comment

valid jetty
hoary sluice
#

and in comes with the added benefit of Haskell compatibility

#

so i can procrastinate writing a tree sitter parser for longer because the Haskell one will work

hoary sluice
#

but probably will in the future

#

so thats another benefit

hoary sluice
#

mainly because there are no mutable variables but also because -= 1 is better

lucid trail
hoary sluice
hoary sluice
#

gn

valid jetty
#

lol

hoary sluice
#

but if you want -- in an immutable language then itd be equivalent to - 1

valid jetty
#

this is postop, it mutates afterwards

#

foo-- will yield foo lol

#

not foo - 1

hoary sluice
#

yes rosie i know how -- works

#

if you cant mutate foo then foo-- is either foo - 1 or noop

#

noop wouldnt make sense

valid jetty
#

foo - 1 also makes no sense lol

hoary sluice
#

neither would - 1 but we need some kind of argument for not using -- for comments

valid jetty
hoary sluice
#

unless foo is a monad and -- calls map(-1)

woven mesa
#

gm

ivory heath
#

matches alone are ugly and add a lot of indentation

lavish frigate
#

real question is why are you not using more match statements, they are more powerful than if statements while looking cleaner, can simply code and most of the time only add a single level of identation

ivory heath
#

branching logic is bad for performance and the human mind is bad at holding a lot of conditional logic

#

the only real use case i can think of for a match statment is when dealing with enums

#

enums themselves however can usually be a value that means something

#

or, well why do you have that many enums

valid jetty
#

you can do things like matching against 2 enums

#
match (x, y) {
    (X::Foo(a), X::Bar(y)) => x * 2 > y
}
#

among others

#

for single-case matching, it’s useless

#

but for stuff like this it’s really clean

#

if you need single case matching use if let X::Foo(a) = x {}

ivory heath
#

please do not use rust for examples

#

only 3 people can read it

lavish frigate
#

well for one the performance cost is negatable due to compiler optimisations (unless you use a shitty language? but well why use that then)

match statements are powerful exactly because they help you deal with conditional logic. grouping together possible branches (since the compiler should tell you when a branch isnt covered) with most of the time the only viable alternative being switch statements (which are ugly and often handled in awful ways like implicit fall-through) or if-else ladders which come with their own problems. lots of conditional logic is also sometimes unavoidable depending on what you are trying to accomplish. like the people here are making their own languages ffs
i.e.
this:

let status = match status_code {
  200 => "OK",
  404 => "Not Found",
  ...
  _ => "Unknown",
}

is much better than:

if status_code == 200 {
    println!("OK");
} else if status_code == 404 {
    println!("Not Found");
} else {
    println!("Unknown");
}

good languages that force you to cover all branches also make exhaustiveness checking easier (something which if/else doesnt do so you can easily run into an uncovered branch). if you use enums and in the future add to the enum the compiler will instantly spring up telling you to cover it which makes refactoring easier. really useful if you need to convert between values & especially guards

if you use rust as an example match statements can also be used on structs & tuples which can be incredibly helpful:

let point = Point { x: 0, y: 100 };

match point {
  Point { x: 0, y } => println!("X is zero! Y is {y}"),
  ...
}
ivory heath
# lavish frigate well for one the performance cost is negatable due to compiler optimisations (un...

well for one the performance cost is negatable due to compiler optimisations (unless you use a shitty language? but well why use that then)
compilers cannot optimize branching conditions without using PGO or bolt passes. I have no idea what world you live in. even then if the hot path isnt hit, the cpu has to walk back the entire pipeline

forcing you to implement all conditions of an enum is nice. ill give rust that. however how many times are you using or forced to use an enum or match statment that how its written matters.

valid jetty
#

and pattern matching isn’t even hard to do, you’re just traversing 2 asts simultaneously and once you meet a catch-all pattern you just allow it to be equatable to the whole subtree of the expression you’re matching

#

“for this interview you will be tasked with traversing a tree” * 2

ivory heath
#

im still flabbergasted at "well for one the performance cost is negatable due to compiler optimisations"

valid jetty
#

until recent years, compilers would not optimize if statements into direct branches like they did for switch/match cases

#

i remember looking at a video on this in c++ a while ago

ivory heath
#

also compilers dont usually use jump tables, instead a binary search on a dictionary

#

because if we have large gaps in our data... lets say 3 to 500, then we have a lot of zeros filing the jump table

#

and an unexpected value will segfault or cause a stack overflow

lavish frigate
ivory heath
#

they get converted to basically the same thing in LLVM IR or get mathed out in POLLY

#

no compiler thinks in C/Rust

ivory heath
ivory heath
lucid trail
#

interesting, if there's no semicolon it sees it as an assignment

#

good feature?

#

man i really have no idea where to start with codegen

runic sundial
#

Anyway, bring benchmarks and your IR/bitcode output to the backup claims that "X IS FASTER" or "Y IS SO MUCH BETTER"

#

At the very least go throw it at godbolt

#

Amen

valid jetty
#

i have this too

fleet cedar
#

What is the value of y afterwards

hoary sluice
#

the value of x is false

fleet cedar
#

Even though the y = 2 is not executed?

hoary sluice
#

you can make it not short circuit declarations

valid jetty
celest lodge
#

x is a boolean then with value false since the boolean and isnt satisfied

valid jetty
#

yea but then what's y

celest lodge
valid jetty
#

y is defined inline but won't be set if the rhs isn't reached

#

so y will be potentially uninitialized

#

i think rust will throw an error about that

celest lodge
#

personally id rather not let inline declarations be a thing

fleet cedar
#

Yeah inline declarations seems just weird

valid jetty
#

it's useful when you don't wanna make sugar for declaring multiple variables at once

#

x:= y := z := 0;

celest lodge
#

walrus,,

ivory heath
#

It’s also kinda hard to show it’s faster in just IR

runic sundial
#

Faster is PGO

#

done by hand.

#

Write code YOU can read

#

Measure the impact

#

Focus on making shit maintainable so you can fix it when it's INEVITABLY slow

runic sundial
lucid trail
fleet cedar
#

What about let x = (let y = 2) == 2 && false;

valid jetty
#

it’s supposed to be lazy

#

if the lhs isn’t true the rhs isn’t even computed

lucid trail
#

Yeah short circuiting

valid jetty
#

so doing it rtl essentially breaks that principle

#

or well

#

flips it

#

gives unexpected behavior

lucid trail
fleet cedar
#

Yes and then what would be the value of y

lucid trail
#

Why wouldn’t it be 2

#

it’ll definitely be LTR

fleet cedar
#

Why would it be 2? It hasn't been assigned

lucid trail
#

((let y = 2) == 2) && false would still evaluate the lhs first

#

I haven’t actually thought this through

hoary sluice
#

would see the false and immediately exit

hoary sluice
#

@valid jetty does #cast return option

valid jetty
#

no

#

if it cant cast its a compile time error

#

actually

#

interesting

#

this makes sense with how the codegen is set out

#

inline variable declarations are compiled before the variable itself, so y := 2 is essentially inserted at the top before any condition occurs

#

not sure if thats intended behavior in this case

#

but at least the value isnt uninitialized

#

actually no

#

we had this the wrong way round lol

#

or

#

hmm

#

😭

lucid trail
valid jetty
#

im so fucking confused

#

y is set to 2

#

but

#

the rhs branch is never hit

#

because nothing is printed

#

so how tf is y being set

#

is it garbage data/? idk

lucid trail
valid jetty
valid jetty
#

that statement is only true for particular cases

#

not in this case

lucid trail
#

should be the same right?

valid jetty
#

yeah why

#

itll just be in reverse order

#

outputto

valid jetty
#

let me examine the assembly

#

holy shit qbe optimized it away

#
.text
.balign 4
.globl _main
_main:
    hint    #34
    stp    x29, x30, [sp, -16]!
    mov    x29, sp
    mov    x0, #16
    sub    sp, sp, x0
    mov    x0, #8
    add    x1, sp, x0
    mov    w0, #2
    str    w0, [x1]
    mov    x0, #0
    add    x1, sp, x0
    mov    w0, #0
    str    w0, [x1]
    adrp    x0, _.21@page
    add    x0, x0, _.21@pageoff
    bl    _printf
    mov    x0, #16
    add    sp, sp, x0
    mov    w0, #0
    ldp    x29, x30, [sp], 16
    ret
/* end function main */
#

qbe detected that its doing 0 == 0 and just removed the branching

#

wtf

lucid trail
#

the compiler did not preserve short circuiting?

valid jetty
#

elle itself did, qbe didnt (apparently?)

#

im still looking into this assembly

#

this is weird

lucid trail
#

Yeah that’s what I meant. There’s 2 str instructions

valid jetty
#

strange

lucid trail
#

after like an hour of reading docs i got a function that adds 2!

valid jetty
#

yay

lucid trail
#

definitely largest sense of accomplishment so far

meager bobcat
#

I found this in the discord code
this always returns true, right?

fleet cedar
#

Might be some sort of browser compatibility check

meager bobcat
#

thats a =, not a ==

fleet cedar
#

Yes

meager bobcat
#

isn't length a read only property

fleet cedar
#

It assigns to an unwritable field and thus should throw a typeerror

meager bobcat
#

oh alr

lucid trail
#

Should I even have unsigned integers? It's pretty annoying since cranelift does not have unsigned integers

#

Yeah I'm removing unsigned types, they add a lot of complexity for me

shrewd canopy
fleet cedar
#

If you want to be a language feasible for practical use, you will have unsigned integers

celest lodge
dense sand
#

is there any k8s devops mage?

#

trynna use the @kubernetes/client-node, but im getting unable to verify the first certificate

#

the config code is literally

import { KubeConfig, CoreV1Api } from "@kubernetes/client-node";

const kc = new KubeConfig();
kc.loadFromDefault();
export const k8sApi = kc.makeApiClient(CoreV1Api);

export default k8sApi;
valid jetty
#

they usually instead have unsigned operations like comparison and equality which you must do differently if it’s unsigned

fleet cedar
#

At the IR/ASM level, types are not signed

#

Operations are signed

valid jetty
#

^^^

#

unsigned types are just front-end sugar, along with using an unsigned version of operations

fleet cedar
#

Addition, subtraction, and multiplication turn out to be the same for signed and unsigned, so there aren't different operations for them

valid jetty
#

the only thing that types themselves tell you is the size, alignment, etc at an IR level

fleet cedar
#

Division and comparison have separate signed versions though

valid jetty
#

as do floats

#

because obviously the memory representation is very different

supple whale
#

its goated

#

works rly well

hoary sluice
valid jetty
#

well i mean yeah

#

typically you promote integers to floats when there is a float in the operation

dense sand
valid jetty
#

not the other way round

dense sand
#

like bruh

valid jetty
#

i mean not necessarily lol

#

sometimes you need that behavior

supple whale
#

its good

hoary sluice
#

just say kubernetes

valid jetty
#

like in rendering for a vector2 but you have a position on a grid which is an integer

hoary sluice
lavish frigate
hoary sluice
#

i meant keep the bits, reinterpret as an int

#

probably need pointers for that right

lavish frigate
#

a11y secretly stands for ally because of pride month but dont tell coorps that

fleet cedar
rugged berryBOT
#

Here is your rs(1.68.2) output @fleet cedar

0.000000000000000000000000000000000000000000024
valid jetty
#

that’s a pun cast 😭😭 ofc that’s not gonna work

hoary sluice
#

o6t

dense sand
lavish frigate
#

o1p

valid jetty
#

m2w

#

n1a

#

c6d

hoary sluice
#

e2e

lavish frigate
#

t2s i0s s0o a1s

valid jetty
#

husk

#

m0eow

lavish frigate
valid jetty
#

i was searching for e yesterday and it literally just wasnt there

#

i thought i went insane but i have a fucking screenshot

supple whale
#

and it just doesnt see minikube

lavish frigate
#

what does kubernetes even do

supple whale
#

average minikube shit

#

i had a full dev cluster in my job so i didnt have this prblem

dense sand
supple whale
#

no clue tbf, i never deployed a k8s box in my life

#

i was just a junior YAML engineer

valid jetty
#

isn’t it more work to count the number of letters in between kubernetes than to just type it out

supple whale
#

if you work in the industry you know k8s is k8s

#

every1 names it that

valid jetty
#

😭 ok

supple whale
#

its not a choice

lavish frigate
#

please use the appropriate abbreviation "e6e" for everyone instead of every1

valid jetty
dense sand
#

who says internationalization instead of i18n

lavish frigate
#

me