#🪅-progaming
1 messages · Page 91 of 1
depends
if you're a big company I wouldn't use it
nop i’m me
then yes
.getOrNone
Doubt
🐈
crystal is really fast while being super easy and fast to write
it feels more like a scripting language than a compiled language
you only rarely have to write explicit types
// overloads
fn Array::__load__<T>(ElleMeta meta, T[] self, u64 i) {
__internal_array_bounds_check(meta.file, meta.line, meta.column, i, self.len());
return self.elements[i];
}
fn Array::__load_ref__<T>(ElleMeta meta, T[] self, u64 i) -> T * {
__internal_array_bounds_check(meta.file, meta.line, meta.column, i, self.len());
return &self.elements[i];
}
fn Array::get<T>(ElleMeta meta, T[] self, u64 i) -> Option<T> {
if i + 1 > self.size {
return None();
}
return Some(self.elements[i]);
}
fn Array::get_ref<T>(ElleMeta meta, T[] self, u64 i) -> Option<T *> {
if i + 1 > self.size {
return None();
}
return Some(&self.elements[i]);
}
idk why but i’m just really interested in exploring other new languages. like zig, gleam, crystal, nim
rosie add visibility operators
zig is irrelevant to me
wdym
private fn Array::load
wh
array::__load__ should not be private lol
its what is called when you do array[x]
/run ```cr
def shout(thing)
puts thing.to_s.upcase
end
shout "hi"
shout 1234
shout ["Hello", "World"]
Here is your cr(0.36.1) output @royal nymph
HI
1234
["HELLO", "WORLD"]
and anyway that exists the operator is !pub

thats only because no mangling, as i have mentioned several times before
a function can be private but theres no mangling so if it doesnt have a unique name itll fail at linking time because duplicate symbols
fix
my list of languages i want to learn is like elixir, zig, rust, crystal, c, swift, objective-c, nim, gleam, haskell, go, v, scala, julia, odin, ts. is it too many? 
you cant call it yourself
!pub is such a weird choice
it's essentially duck typed but at compile time instead of runtime. the compiler infers types for you
but you can also explicitly type stuff if you prefer
oh it uses ends eh
its not, it allows the toggling to be very simple
you can also use brackets
oh that’s neat
thats exactly the point, !x is a way to make it general across all modifiers
either it has modifier x or it doesnt
thats way more confusing than just explicit words
whats the opposite word for external
internal
/run ```cr
2.times do
puts "hi"
end
2.times {
puts "hi 2"
}
Here is your cr(0.36.1) output @royal nymph
hi
hi
hi 2
hi 2
internal doesnt mean what it should here
wtf the syntax is unsane
because !external means the function isnt externally defined and needs to have a body
that is not an internal function

2.times is crazy 😭
i love this lmaoo

/run ```cr
puts [1, 4, 2, 3].sort.map(&.to_s).join
Here is your cr(0.36.1) output @royal nymph
1234
im confused do u like need brackets for func arguments or not
they're optional
oh
if i had to guess, func(x) is the same as wrapping an expr in parens
so its as if you did func((x)) in a language where its mandatory
/run ```cr
puts [1, 4, 2, 3].sort.map(&.to_s).join '-'
puts([1, 4, 2, 3].sort().map(&.to_s).join('-'))
these are the same
Here is your cr(0.36.1) output @royal nymph
1-2-3-4
1-2-3-4
how does it differentiate between fields and function calls 😭
by simply not allowing fields and methods to have the same name
most languages don't allow that
wtf are macros just regular funcs or what
I know of Rust and Java that do, and C++, python, and js that don't
this is so clean
I really want to do something with crystal now
love
Cringe, yoda expressions are
/run ```cr
puts "balls" if 42.positive?
@royal nymph I received cr(0.36.1) compile errors
Showing last frame. Use --error-trace for full trace.
In file0.code:1:20
1 | puts "balls" if 42.positive?
^--------
Error: undefined method 'positive?' for Int32
Showing last frame. Use --error-trace for full trace.
In file0.code:1:20
1 | puts "balls" if 42.positive?
^--------
Error: undefined method 'positive?' for Int32
how
hmm this seems hard to follow control flow
maybe old crystal version that doesn't have positive? yet
macros in crystal sound powerful
if you overuse it sure
I find it easier to read during other times tho
especially with continue
Are there any benefits to return x if y == 7 over if y == 7: return x
continue if makes sense actually
arr.each do |e|
next if e == 42
puts e
end
I think it reads nicer cause it has the more important bit first
makes it easier to scan
The important part, such as being a conditional?
is that the only way to do it or can you do it the other way too
the important part is that we continue :P
other way too
No the important part is that we maybe continue
there's also unless keyword
it's one char shorter 
arr.each do |e|
next unless e == 42
end
I keep writing continue cause I'm used to it

If I were to write something in crystal (an unlikely prospect though) I would set up a linter rule that prohibits such out-of-order statements
^
do yall think it’s possible to make a vc plugin that adds more languages to code blocks?
you're only saying this cause you're used to non yoda 🐮
So just gotta get hold of the hljs instance, which probably is already in vencord.common
oh alright then i think that’d be very useful as a plugin though
Partly that, sure
But also partly because the feature objectively sucks
nuh uh
can you just pr tree sitter grammar to hljs
No, hljs uses hljs grammars
husk
/run ```raku
grammar Parser {
rule TOP { I <love> <lang> }
token love { '♥' | love }
token lang { < Raku Perl Rust Go Python Ruby > }
}
say Parser.parse: 'I ♥ Raku';
Here is your raku(6.100.0) output @spark tiger
「I ♥ Raku」
love => 「♥」
lang => 「Raku」
Yup
A simple one I wrote some time ago ```js
hljs.registerLanguage("calmare", hljs => {
const TERM = [];
TERM.push({
className: "number",
begin: /0[xX][0-9A-Fa-f]+/,
});
TERM.push({
className: "number",
begin: /(-|\b)\d+(.\d*)?((mm|ms|deg|mdeg)(/s)?)?\b/,
});
TERM.push({
className: "tag",
begin: /\b(flag|system|var|global|name|bgm|magic|quest|shop|sound|town|battle|item|look_point|entrance|object|trigger|label|anim|chip|vis|fork|eff|eff_instance|menu|sepith|at_roll|placement|fn|file|char|field_party|party|custom)[/,
end: /]/,
contains: TERM
});
TERM.push({
className: "tag",
begin: /\b(self|null|random)\b/,
});
TERM.push({
className: "string",
begin: /"/,
end: /"/,
});
TERM.push({
className: "string",
begin: /@\w+/
});
return {
unicodeRegex: true,
aliases: ["clm"],
keywords: [],
contains: [
...TERM,
{
className: "function",
begin: /\{/,
end: /\}/,
contains: [
{
className: "keyword",
begin: /\{/,
end: /\}/,
contains: TERM,
},
{
className: "keyword",
begin: /#\d*[A-QS-Za-z]/,
},
{
className: "keyword",
begin: /#\d*R.*#/,
}
],
},
hljs.COMMENT(/\/\//, /\n/),
{
className: "symbol",
begin: /[-+*/%&^|<>!=~]+/,
},
]
}
});
for(let e of document.getElementsByClassName("language-clm"))
hljs.highlightBlock(e);
write a TextMate grammar and use shiki instead
wow so simple!
crystal is definitely not perfect by any means but I still love writing it
it's such a fun language
I just wish the language server was better
and need more opportunities to use it

Rewrite vencord in crystal
What's the difference between a pojo and a bean
YOP
i think pojo is plain object java object which is a more general term for a data-only class
you take showers?
even though my project pure typescript i should write the schemas in java and convert them because i love java
And bean is a plain java object with getters and setters for each field
Thereby inflating the line count by 5x and gaining absolutely nothing whatsoever
true
i love just using public fields in oop languages

remembering how you need to manually write constructors in java
I hate getter setter pattern
getter setter is the worst thing to ever fucking plague programming
like it completely voids all invariants you can have about fields in a class or struct
the fact that i could write a program
int x = foo.a;
int y = foo.a;
``` and x and y can be different is the worst fucking thing ever
Yes but bean getter/setter pairs also have no invariants
the problem is that the syntax is the exact same as regular fields
No, getFoo() is a very different syntax from foo
getter setter is more bearable if the language has sugar for it
oh well i mean yeah
true but i think we were talking about java getters
The problem is that the semantics are the same even though the syntax is boilersome
those are fine because you know youre calling a functon
which are often used when they are just directly returning the field value
and not doing anything
just for no reason
you can say this about any impure function
tbf just don't write bad code and if the language is not single threaded you have that problem either way

but yes I hate getter and setter too
rw field >>>> get and set
no, because you know youre calling a function at those points
at this point unless you read the impl you cant know whether this is a getter or not
solution: everything is a function
just use NixOs
variables are functions in icy
elle will be used as config language in nix
elle will replace nixlang
yeah exactly
wdym
what if you dont depend on side effects, only on internal state
give example
val x: Int get() = y / 2
@hoary sluice
@deep mulch
the point is that you cant know whether simply accessing a field has side effects
are you saying you dislike getters even with sugar
document the getter
in any sane language, doing a field access is invariant, it cant possibly have side effects because all it does is a memory access
just dont use dependencies
as soon as you bring getters and setters into the equation, unless you know what the field is represented as internally, you no longer have that guarantee
in any sane language, calling a function is invariant, it cant possibly have side effects because all it does is a memory access
that is not true lol
in 1 year elle will look and behave exactly like rust and rosie will rename to rust
depends on your definition of sane
if your code has no side effects it just does nothing
in what language is it sane to have side effects accessing values with syntax exactly the same as normal field accesses
its not sane
lmao exactly my point
lazy variable initialization with caching maybe
i didnt disagree with you
altho ive never had problems with it in kotlin
the whole thing is that youre turning a pure operation into an impure one (a function call)
insane
there is no equivalent things when calling functions because in procedural languages every function is impure, thats not an invariant
i should make a scripting language called lasagna
and then make its syntax javascript
@valid jetty do u use vim-surround
yeah constant
i think its built into zed
add JIT and AOT to elle
what is the type of x
is it () => i32
internally yes
i suggest making rand:randomi32
this is not sane
are you inlining constants
didnt you just complain abuot this

random::next_i32
:kotlin
well yeah because the behavior is more like this
thats kinda the idea behind it
this is so awesome https://github.com/Wansmer/treesj
rename const to constexpr
😭
the difference here is that i dont make an invariant that accessing constants is pure
i dont think you should be using const for that
in fact i specifically state its not
inline
idk what keyword to use
yeah probably
its not a macro either
tbh i just use constexpr for stuff i want inlined
not really clear on the difference between inline and constexpr in c++
its a less powerful #define no?
wbat the fuck
the internal representation is like this
use std/prelude;
fn x() { return rand::random(0, 6); }
fn main() {
$dbg(x());
$dbg(x());
$dbg(x());
$dbg(x());
}
much more powerful define
const is a constant, its value should not ever change
you can make a constexpr function that takes a constexpr computable value and does stuff like recursion in it at compile time
thats why c++ takes so long to compile
ohh i guess you use constexpr for it to compute it, not just inline it
you can make a fib constexpr function where you pass it 142 and it computes the value from your function at compile time
yeah, const is not the right keyword to use here
but it works in most cases
wouldnt it just be a function
rosie is a javascript enjoyer
its a function but its called automatically
yop
^^^^^
hmm
im very clear about this in the documentation
It is labelled as a "constant", because although it can return a different value (it can call any function), it cannot be redeclared.
that kinda seems like a weird choice
yeah but idk what keyword to put
function
,
well yeah
getter then
its internally a function not semantically
but the difference here is that im not doing a pure operation
when you access a top level "thing" you know it can return something else
In computer programming, a constant is a value that is not altered by the program during normal execution.
idk what keyword to use
getter or function
use std/prelude;
const x = rand::random(0, 6);
fn main() {
$dbg(x);
$dbg(x);
$dbg(x);
$dbg(x);
}
use std/prelude;
fn x() { return rand::random(0, 6); }
fn main() {
$dbg(x());
$dbg(x());
$dbg(x());
$dbg(x());
}
a getter keyword is so horrible
i dont really see the issue with fn
its not a function
you can define lambdas in constants
you will do lambas like kotlin @valid jetty
kotlin compiles lambas to classes and gives them insane names
look at the stacktrace here
Why does the stacktrace have a sunset background
yea elle does that too lol
beautiful
why is it mangled
cause its Aliucord
did you enable proguard
Lambdas do get ugly names yeah
it just calls the function lambda.{tmp_counter++}
the user who posted that screenshot was using that theme
i think newer kotlin its simpler
/run ```java
Runnable r = () -> {};
System.out.println(r);
System.out.println(r.getClass());
Here is your java(15.0.2) output @fleet cedar
temp$$Lambda$192/0x0000000800c77a48@27fe3806
class temp$$Lambda$192/0x0000000800c77a48
Very beatufl
Here is your kt(1.8.20) output @royal nymph
() -> kotlin.Unit
is that even right
no
1.8.20 so OLD
FileKt$$Lambda$13/0x00007fbeb0003a20@1b2c6ec2
val l = {}
fun main() {
println(l)
}
why is it just {}
i think its classname/address/hashcode
horror
INSANE
oh
Unit.a @deep mulch
kotler so unsane for not having void
how
Just want to add that c++'s handling of the void type is hilarious
And very very painful if you're doing template crimes
isn't Unit void
Yes, unit is what it's called in languages developed after type theory was invented
sounds fun
void*? More like Any*
does qbe generate debug symbols?
i think you can get it to
there’s something like dbgloc as an instruction iirc
i haven’t looked into it yet
what are either of those words 😭
hardware
like programmable circuitry
A field-programmable gate array (FPGA) is a type of configurable integrated circuit that can be repeatedly programmed after manufacturing. FPGAs are a subset of logic devices referred to as programmable logic devices (PLDs). They consist of an array of programmable logic blocks with a connecting grid, that can be configured "in the field" to int...
Hardware isn't real
yeah it's hard 👍
@valid jetty how are you not going insane making elle
you cant go insane when youre already insane
thats a good point
(since this is a prog question)
@tribal sapphire
how do i make getline() get from stdout ?
OH MY GOD
its supposed to be STDIN
😭
mfw im r*
immana' cry man why am i so dumb
you cant go insane when youre already insane
wait so if the ascii table goes up to 127 why is it signed to go to -128 and why can it go up to 255 when unsigned
whats the actual use for that
wouldnt it be much more efficent to just have it limited to the ascii table size?
If you're talking about C's char type, that's not a character
That's the smallest addressable size
Which is called char because... reasons I guess
people only needed 127 characters back in my days 👴 /jk
yeah the char type.
why does it allow me to use values
that arent in the ascii set?
Because it has nothing to do with textual data
huh
wait doesnt char support unicode?
no wait i'm way off
How would an 8-bit integer support unicode
would it at least support UTF-8 ?
i didnt know there was this much to C data types until i saw "ungisned char" in wiki
and decided to google this
now it feels like im going down a sinkhole
UTF8 is defined in terms of bytes, yes
Just like every encoding of everything ever, since cpus and storage both deal in bytes
ive always assumed char was limited to 127 since if I was a prgorammer back when computers needed to be the most efficent things immaginable I would also have char limited to a 0-127
yes, but adressing things in 7 bits is inefficient
we want a byte not almost a byte
so its 8 bits instead
Powers of two are good
yeah
I mean you can fit a boolean there
you can
so there's no reason why it's called char for it to store a character?
can i store a character in a int32_t ?
@valid jetty make Elle have 1024 bit numbers
yea
it would just have lots of padding
in that case why not just make up a character and shove that in as 128
mind absolute blown
you can, but its pointless because ascii chars fit in 1 byte
(rlly)
then have it 0-128
wb emojis
why am i asking i could literally try
yes, you can fit 1 whole unicode grapheme in an int32_t
1 byte for the length and 3 bytes for the actual data
you can
is that not the same thing
u smort
me dumb
pls no mad at me okay ? :3
then why the negative numbers? and why let it run up to 255 when unsigned? I swear thats just not-memory-efficent
Wdym
8 bytes can hold 256 different values
wait no its not in the heap
-128-127 when signed, 0-255 when unsigned
stack-maxxing
if you make it unsized you can fit an extra 128-sized enum in the empty space by doing x-127
why not just keep it unsigned? do negative numbers not make it really weird?
If you want unsigned numbers, use unsigned numbers
well actually it is unsigned on some platforms lol
If you want signed numbers, use signed numbers
its signedness depends on the platform
The cpu doesn't care, it's just 8 bits
yeah ^
eh fair enough.
Types exist in programming languages, not cpus
but you could make cpus in programming languages
signed vs unsigned is just a difference of how the byte(s) are interpreted by the language
"when i grow up im making my own char type which goes from 0-127 and cannot be signed, i will also force the cpu to store bools after each char if avalible for less fragmentation"
Elle will only have signed types
that’s not how fragmentation works
yeah my concepts of it are really hazy
mm yes my bool goes from -1 to 0
storing a bool right after a char means if you want to retrieve that bool you would get a non-aligned pointer
It would also make memcpy not work
i mean i guess
Semantically yes
But in most languages it's a primitive type
but an enum is also a number in most languages
how do languages
uh
that bind enum to strings or other types
like
ENUM : String
it can fit into 1 bit but usually we store it into 1 byte for alignment
enums are entirely compile-time sugar
C is not most languages
when you do Enum.Foo it just substitutes the literal for that inplace
C is the father of most languages
so in preproc
it all gets
other than rust, name 3 languages where enums are not named constants
oh yeah wait how do pointers actually work anyways? like when I ask the os for memory it gives me a pointer to the memory but then how do I know where my range of memory stops? Like im not given 2 pointers right?
like replaced?
They are named constants in most, yes
They are not integers
you dont, youre the one to tell that to the computer
In c/c++, discipline
chatting with absolute choding people and not knowing anything is amazing
but does that not mean i could just overwrite some other programs memory space cuz I dont know where to stop?
No, the OS typically won't let you
on older computers yeah
It knows which memory ranges are assigned to your process and gets whiny if you violate that
but nowadays memory space is lazy and every program thinks it’s the only program that exists in terms of memory
and if you access something you’re not allowed to, you get a segfault
so if I need to write something bigger than the space I have then what happens?
does it write over? does the os kill the process?
@valid jetty hiii
You get a segfault
ah those lovely things
when are you writing more than 16gb of memory
Which typically kills the process, unless you have a funny signal handler
yeah
when I suck at programming (or im using python)
System | OOMD handler ?
or i guess they're both the same
Consider asking questions that are pareseable
wait so the OS always gives the same amount of memory?
yes sir.
no, the OS gives an amount of memory at least as large as the amount you tell it
if you ask malloc for an amount bigger than it can give you, the pointer will be NULL.
and you try to use that pointer you will segfault
but if you don’t have enough memory left you have bigger problems
oh and thats hidden from me in 90% of the languages I use
joverly
well yeah because usually you’re not doing manual malloc calls
and im guessing having something like
char d[4];
just uses the stack instead calling for heap?
Unless you ask for heap, you're not getting heap
C the language does not have a concept of a heap, that's a library thing
then how can I still write to my char even if i have about 15 return adresses pushed onto the stack?
@valid jetty is made of pie
does it all get popped off or does C remember the stack offset for me
What do you mean
You can write to it since you took a pointer to that region and passed it down those 15 calls
oh yeah but then how does the program know where the bit of memory stops? like how does it know my char stops there and my boolean starts here
and doesent read the boolean as part of the char?
what so it just doesent stop reading from the stack?
Or something else that happens to be nearby, stack layout is not guaranteed
It reads exactly as much as you tell it to read
If you tell your program to read 8 bytes starting at d, then it reads 8 bytes starting at d
wait what does that look like in C?
It is, but it hides pointers from you really well
im sure im gunna have fun in uni
I really didn't understand them until I did a project in C
what about pointers is actually so horrible anyway?
from what I know they are just a memory adress
They're very very easy to use wrong
"use wrong"...
use wrong how
now im scared
d[7]
7[d]
Use after free, double free, null pointer, out of bounds, aliasing violations
never seen double free or aliasing violations before
I always get hit by the segfault errors
Double free isn't anything special, it's just a subcategory of UAF
Compiler can often make much faster code if it knows two pointers are not the same
If you tell it that these are not the same but they are, then you have an aliasing violation
im guessing this one isnt really done directly?
C has noalias annotations which tells it that "these pointers do not overlap"
so compiler flags can actually altogether stop this error?
since its an error purely thrown because the compiler tried to cut corners?
C does not assume pointers are nonoverlapping by default
But things can get a lot faster if you tell it to
oh yeah is compiler entropy a thing in every C compiler or is it just windows?
Uh, wtf is that supposed to be
That is complete nonsense
sick alr imma go spend the rest of my night reading wiki pages
why would it do that
void trim_whitespace_entire_string(char *str);
void trim_whitespace_begin_string(char *str);
void trim_whitespace_end_string(char *str);
am i supposed to use something else?
wtf are those names
doesn't trim imply whitespace
im sorry 😭
trim_left
trim
trim_left / trim_start
trim_right / trim_end
trim_start
trim_end
trim
??
ig that good ?
no but more like
doesn't C have trim funcs ?
or glibc ?
C doesn't really have strings
right
C has nothing
yeah
You shouldn't use it
it made me appreciate rust a lot more
am i right ?
These days, C is an abi, nothing more
i'm contemplating which one to learn
with the goal of generally learning low-level computing
In other words, how different languages can talk to each other
what would you suggest for me tho @fleet cedar ?
I'm not a teacher, I don't make curriculums
you have experience
and you know a large amount
probably rust, but do some things in C too
oki
LEFTUNPAD!!!
chat why the fuck does using "*" for app.get not work and give me this shit
C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:73
throw new TypeError(`Missing parameter name at ${i}: ${DEBUG_URL}`);
^
TypeError: Missing parameter name at 1: https://git.new/pathToRegexpError
at name (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:73:19)
at lexer (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:91:27)
at lexer.next (<anonymous>)
at Iter.peek (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:106:38)
at Iter.tryConsume (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:112:28)
at Iter.text (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:128:30)
at consume (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:152:29)
at parse (C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:183:20)
at C:\Users\zander\Documents\GitHub\Parlix\node_modules\path-to-regexp\dist\index.js:294:74
at Array.map (<anonymous>)
Node.js v20.18.0
i hate i hate i hate
im sorry im sorry im sorry 😭
musl so annoying
probably a great concept but stuff depends on glibc
i thought oh cool glibc alternative
wasted a day
@nimble bone is nina nina-ing
windows 
hii its been a while
send your entire function
whatever send your code
app.get("*", (res) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
});
that's what's erroring out
first argument has to be the request afaik, 2nd has to be the response
i think
so do like (req, res)
unless i'm blatantly wrong
The res argument should be req, res. It's missing the req (request) object.
Issue with this code?
insane
lemme send my file
if you change * for / does it work
yep
try /*
if you dont have a lot of experience with programming, especially with languages that dont give you everything for free at the cost of performance, you will have a hard time understending why rust does stuff the way it does; there are 2 extremes to this, a university i know starts their students with pascal because its simple, and many others start with python, which is one of the worst choices imo
you should learn c first, everything everywhere is compared to c, if you know how it works in c you can understand the comparison and will have a much easier time learning other systems languages
but dont spend too much time on it - dont master it
webdev was easy to learn for me and the best option i think
if you start a 14 year old (technical high school) on javascript, they will probably have a hard time finding the motivation to learn anything but webdev
my high school started with C, and after 2 years started oop with C++ and Java, and a bit of js at the end; nobody in that class can or wants to use anything else
and they were taught for 5 years
and in 2025 its quite likely they will just become an ai bro
css was the bestlanguage first for me because it's what you can SEE the fastest and i learn visually and by doing
well for the past year (now it's over, i'm doing my final exams, 3 left) our programming was C#
which is kind of basically microsoft java (in terms of level)
so im not really beginning with python
i think my problem is more like
i don't stick to things
but i want to
i went css>html>js>ts
i'll learn c one day but that shit is complicated as fuck and COMPILING BRO i cant
i think my problem today mainly with C was just
how am i supposed to know a functions name
because man pages are really
making my head spin
vibecode it
see this is what i meant, its easy for someone who started with C to do webdev because its easier than what they started with, but hard the other way around
like it's fair for C to be hard for me, because i'm not a person that worked with memory since my experience was in C#
but like
i wanna
i want to try
i'm just mad at manpages
and well i'm just sometimes dumb
like setting getline(*buf, *buf_size, stdout)
Yes same exact, path, except i went to rust like a year ago
Python is very easy
Its 53 years old and has barely changed since, it has some weird semantics because of how bad hardware was back then but you just have to deal with that
I went js then java then cpp then python
but is there some advice you could give for documentation ?
like
rust api docs are so easy
can search and everything
examples too
😭 idk if u saw but i said it didnt fix
i've tried like everything
i did scala > java > c > cpp > kotlin > rust
yeah you did the whole midlevel programming pipeline
probably just an llm
i should get ollama fr
much different than the skilltree i fell down
c is big enough for llms to properly document it
minecraft pipeline
real
Java to write minecraft mods fr
at ~11 years old my dad dropped me into a scala repl, ran help and told me to make smth
i was forced to learn java against my will
I started with java too (for minecraft)
I learned Java to make Bukkit plugins :D
i started my life off sticking to science until i got a computer at 13 so it was a hard switch
it was after i lost my extreme love for mc modding
I started programming since 2019
Back then I used only javascript
I'm not really sure how long I've been programming, but I had a backpack from an international programming competition labeled 2015, so probably started several years before that
i have a hard drive with an early version of https://github.com/eagely/meowmod from 2020 so i started minecraft mods in 2019 or 2020, not sure about stuff before that
i think i did some scratch
and the scala thing
@solid gazelle
@woven mesa @young flicker I made a simple swiftpm package which changes your keyboard color
but I havent figured out how to change the predictive bar yet
it uses swizzling to force the color change
omg
so cool
what did u swizzle
im not as smar as u
@woven mesa I think you can customize more than just the colors, I did something funny with the keys
Click this link https://sponsr.is/bootdev_mattbatwings and use my code MATTBATWINGS to get 25% off your first payment for boot.dev.
Patreon: https://www.patreon.com/mattbatwings
Discord: https://discord.gg/V5KFaF63mV
My socials: https://linktr.ee/mattbatwings
My texture pack: https://modrinth.com/resourcepack/mattpack
World Download: (JAVA 1....
3d game in a 2d display in a 3d game in a 2d display in a 3d world 😭
tsoding server is so funny 😭
@nimble bone i ended up doing some fucked up regex Lol, my discord clone "PARLIX" is coming along swimingly so far, very slowly tho
those things are attachments i'm gonna add a header or smthn and put the attachment count with it too
even has deletion
just realized the icon isnt aligned this is bothering me
there 😭
@hoary sluice is this true
this is the message im replying to
read it out-of-order i guess
completely agree 100%
theft machine 9000 that only makes brains become mush
i feel like ai shills going "we need to make {field XYZ} ai first!" and then people with experience in that field going "no?? dont do that wtf it ruins any enjoyment working in the field" is the biggest thing
the disconnect is huge
so true
i feel like we ran out of stuff to invent so we just resort to scraping the bottom of the barrel
lmao literally
i saw a video titled "Minecraft 1.8 is finally dead. We killed it" and i think it embodies that perfectly
it died because everyone eventually got bored of nothing new and moved to newer versions while at 1.8 its the same thing with some spin on it
same thing with ai except people arent updating
or well
the ai shills arent updating
actual software developers are
as tom scott once said, "people like a mix of novelty and familiarity"
change nothing, people get bored and move on
change everything, people hate it and move on
so true
people have become so familiar with ai that their brains have turned too much into mush to realize it
one day ai websites will be down and theyll be told "write this algorithm" and theyll have no idea because they used to just have ai write it, even if they could write it by hand in the past, ai polluted their brains and made them stupider "oh yeah why should i need to remember this information, ai will regurgitate it for me when i need it"
im just waiting for this to crash like the dotcom bubble
true
I've found it useful for learning some things though
And AI is sooo bad at debugging, if it doesn't one shot something its basically cooked
i ordered a corne with an aluminum case, i'm so excited
how can i use css to change server icons from the client side?
you can use inspect element to find the class for the server icon
you can then do content:url("yourimages.com/url")
Replace the number with the server id and the link with your replacement icon
[data-list-item-id="guildsnav___1015060230222131221"]
[class*=icon] {
content:url("https://files.catbox.moe/39yx8f.jpg");
}```
may try this in the morning, thanks
if i want to ignore an error is it good to do this ?
int main(int argc/* ,char **argv */)
Uh, what is that supposed to mean
i mean inline commenting out the part that is causing the warn
yeah unused variable
both argc and argv
so i just commented them out
like this
int main(/*int argc, char **argv*/)
If you do not use argc and argv, just do int main(void)
oki
Why not mention typing assistant
Refactoring a 300 line match statement into separated functions takes a long time even with vim
llms solve that
Yeah and insert a few subtle bugs in the process
well no i can see what it did
and the task is simple enough for claude 4 not to hallucinate anything, its very good at moving code around
my take is that ai makes producing code cheap so if you need some new functionality you should scrap the existing implementation out and let ai do it anew with your new requirements
thats not fun to do and everything will collapse quickly
My take is that throwing out a working implementation in favor of ai slop is a terrible idea
a decent part of my voice assistant is made with llms and while it works now, it was painful to implement and i wish i wrote more of it myself
not always
if you remember my unsafe impl Send, Sync
i threw that out in favor of an ai impl with a separated thread for recording and it works
yeah, but 300 lines is like nothing
it’s almost always better to do it by hand even if it’s slightly inconvenient lol
its not fun to extract 30 arms into functions
i did most of it by hand and got extremely bored
no, but when it’s done you know it’s correct because you wrote it
i feel like you should use LLM for when you don't know some sort of docs (at least for my case it's been like that.)
i feel like knowing the return value and func parameters are the only thing i'd really need an llm to answer me
Why would you use a llm for that rather than docs
Unless your language docs suck ||c++||
when i told claude 4 what to do, have an example of how its done (manually done 1 or 2) and its just moving around code, and it passes all tests, then i have nothing to worry about
well my brain too dumb for docs
nix
the only good piece of docs i've seen so far was in a pdf
That's an oxymoron
"Good docs" and "pdf" are mutually exclusive
i dont think we should "give in to the vibes" but completely rejecting all llm code as slop is also less productive
the atmega 32u4 datasheet is pretty good id say
and its a 450 page pdf
Imagine how good it would be if it was in a useful format, then
Pdf is good for printing, nothing else
using llms as advanced vim macros is completely fine imo
Here’s an example of how to use waitpid to get the status from all child processes
that have terminated, without ever waiting. This function is designed to be a handler for
SIGCHLD, the signal that indicates that at least one child process has terminated.
void
sigchld_handler (int signum)
{
int pid, status, serrno;
serrno = errno;
while (1)
{
pid = waitpid (WAIT_ANY, &status, WNOHANG);
if (pid < 0)
{
perror ("waitpid");
break;
}
if (pid == 0)
break;
notice_termination (pid, status);
}
errno = serrno;
}
And who the fuck prints docs
this
datasheets are printed very often so it makes sense for it to be pdf
one use case today is if you have an electronics exam and the student has to do something with an arduino, you might print the section of the datasheet that they need
and back when these were created these scenarios were more prevalent
there were schools/unis that didnt have computers for every student
so datasheets were made to be printable
some of them are garbage, some of them are awesome, i dont think pdf limits docs
there are good pdf docs and there are non-pdf Nix docs
software docs will almost always be a website, because writing software means you have a computer to look at them; if you are working with electronics, you might not have a computer and the docs will therefore be in a pdf to be printable, but this has nothing to do with how good they are
hey you can print websites
Yeah and it usually turns out like shit
yea go give your students a printed readthedocs page, they will laugh at you
ok no they wont but it wont be the best experience for them
char *path_name = "/usr/bin/";
char *prog_name = va_arg(args, char *);
char *comb_str = path_name + prog_name;
why does this not work?
the first two are string literals so i can't add them up in like
prog_name itself
but then i try making a new string which combines those two
and it doesn't let me?
over time i learned that readthedocs aren’t real docs
why
that’s um
not how C works
it completely depends on whose readthedocs it is
😭 help me ma'am i stoopid
null terminator stuff
isnt there a function to combine strings
strtok or smth
i haven't found it
strcat
then do it backwards
path_name is an address in memory, comb_str is an address in memory. adding them will give you an invalid address in memory. what you want to do, is to use malloc with strlen(path_name) + strlen(comb_str) + 1, then iterate both strings and set chars in your new string, and finally insert a null terminator (‘\0’) at the end of the str
hm
no not even
oh i didn’t know that existed
That looks like a buffer overflow
its not a buffer overflow if you dont care
It just overwrites whatever's after the string in memory
probably overwrites starting at the \0
mmkay thank you :3
C is very low level. you don’t get almost anything for free :3
any feature you want, you have to implement manually
i mean, i kinda like that
but then i realize im stoopid
even as simple as string concatenation
and then you learn !!
i might do that atp
oh yeah that’s just an abstraction for this lol
it’s just a dynamic array you can push to
c is built for use in 1972, not 2025
so is this safe then ?
char *comb_str;
comb_str = strcat(path_name, prog_name);
i don’t think so
i still don't even know if i'm supposed to use free() or not
nop, that’s allocated on the stack
That's fine if path_name has enough space to hold the concatenation
which it doesn’t because it’s a string literal
would it be okay if i just allocate 1024*4 for all of these ?
yeah probably
youre overwriting strlen(prog_name) - strlen(path_name) bytes of memory
if its 0 then its fine
but theres probably a safer way
its probably not 0
this is probably the simplest way???
char *comb_str = (char *)malloc(strlen(path_str) + strlen(prog_name) + 1);
strcpy(comb_str, path_str);
strcat(comb_str, prog_name);
``` and get out a null terminated string
well sure
with error detection
wait but this
char *comb_str = (char *)malloc(1024);
is it the same as this :
char *comb_str = malloc(1024 * sizeof char);
??
yes
Nope, that's ub
on most platforms the size of a char is 1 byte
You need comb_str[0] = 0; first
but you memcpy into it
No, you strcpy
that inserts a null terminator for you
that’s what i meant
Which means it skips past any non-null bytes and then pastes it there
Which can be at an arbitrary point since malloc doesn't zero
why
isnt strcpy the same as strcat then
Wait mb misread strcpy as strcat
oh
but now what if accessing prog_name inside the comb_str assignment caused a side effect
and made prog_name grow by 2MB
what
do you not remember yesterdays conversation
did i put it the wrong way round
no i remember
but nothing should be growing
i dont think field access can make side effects in c
oh my god i so stoopid i make malloc for a string i already know the length of
dont think that causes a segfault
no but
just live reporting my dummyness
:3
makes me remember later
if a char is 1 byte
then i don't need to
i could just do malloc(1024)
right ?
am i right ? ^^
malloc(1024) will break if strlen(path_name) + strlen(prog_name) > 1024
look at this
why specifically 1024
no specific reason
do you know that path_str + prog_name + 1 will never be longer than 1024?
if not, malloc according to their lengths
well i don't know how to keep track of it
.
but its user input
you just take their length lol
the way you keep track of it is you take its length
uhhh you can but it’s not necessary here
yes you can
youre mallocing another variable
@valid jetty can i
char *foo = malloc(17);
foo = malloc(26);
theres nothing wrong with that right
itll just get 26 new bytes somewhere else
char *prog_name = (char*)malloc(strlen(va_arg(args, char *)));
is this right now ?
What are you doing with that va_arg btw
Well you leak memory but
void execute_prompt(int n, ...) {
va_list args;
va_start(args, n);
char *prog_name = (char*)malloc(strlen(va_arg(args, char *)));
int status = 0;
char path_name[10] = "/usr/bin/";
prog_name = ;
char *comb_str;
comb_str = strcat(path_name, prog_name);
// strncat(prog_name, path_name, strlen(path_name));
for (int i = 0; i < strlen(comb_str); i++) {
printf("%c\n", comb_str[i]);
}
// pid_t pid = fork();
// if (pid == 0) {
// /* This is the child process. Execute the shell command. */
// execl(prog_name, NULL, NULL);
// _exit(EXIT_FAILURE);
// } else if (pid < 0)
// /* The fork failed. Report failure. */
// status = -1;
// else
// /* This is the parent process. Wait for the child to complete. */
// if (waitpid(pid, &status, 0) != pid)
// status = -1;
va_end(args);
}
and a lot of other issues
like no header
but my question was if that segfaults or not
im guessing not
No, assigning a variable doesn't segfault
bold statement
i wouldnt be too sure
@valid jetty maybe assigning to that variable creates a side effect that segfaults
use realloc
that was not the point
it wouldn’t do anything
it just makes the original memory before you reassigned unusable
yes i know
it doesn’t free the previous memory it just overwrites what the pointer in your variable holds
its cause of this
i was saying
yea
malloc is just a function
obviously its semantical nonsense
yea no there’s nothing wrong with it it just makes no sense
it might have side effects if the program was written by rosie
um, @fleet cedar ?
So you're doing a varargs function that takes exactly one extra arg
Sure, fair enough
😭
well i'm supposed to take
multiple
for argv of the program that is supposed to be ran
probably two actually
two strings
good thing you told me
*** stack smashing detected ***: terminated
what does this mean now?
It means your buffer overflow corrupted the return address or similar
let me gdb it
help
You are beyond saving
demonic amount of free space
tru

