[a / b / c / d / e / f / g / gif / h / hr / k / m / o / p / s / t / u / v / vg / vm / vmg / vr / vrpg / vst / w / wg] [i / ic] [r9k / s4s / vip] [cm / hm / lgbt / y] [3 / aco / adv / an / bant / biz / cgl / ck / co / diy / fa / fit / gd / hc / his / int / jp / lit / mlp / mu / n / news / out / po / pol / pw / qst / sci / soc / sp / tg / toy / trv / tv / vp / vt / wsg / wsr / x / xs] [Settings] [Search] [Mobile] [Home]
Board
▼ Settings Mobile Home
/g/ - Technology

Name
Options
Comment
Verification
4chan Pass users can bypass this verification. [Learn More] [Login]
File
  • Please read the Rules and FAQ before posting.
  • You may highlight syntax and preserve whitespace by using [code] tags.

08/21/20New boards added: /vrpg/, /vmg/, /vst/ and /vm/
05/04/17New trial board added: /bant/ - International/Random
10/04/16New board for 4chan Pass users: /vip/ - Very Important Posts
[Hide] [Show All]


[Advertise on 4chan]


File: carmack-quote.jpg (50 KB, 842x392)
50 KB JPG
What are you working on, /g/?

Previous thread : >>110323145
>>
ive been thinking- the op is kinda barebones
maybe we could put some sauce on it
books, resources, codebases, idk
>>
>>110368901
I don't know man. I just tried to sit on my temple machine and either I have to move as slow as a crippled snail or starting with a HolyC compiler in HolyC might not be a brilliant idea.
Not sure tho which one it'd make easier. Choosing a different source or target language. Probably irrelevant, I could target a super small subset first
>>
>>110369314
i think your problem is that theres a part of you that wants to do practical shit when another just wants to program for fun

how bout we go perpledicular?
how bout we consider your projects not as goals to accomplish, but labs to develop skills?

there the question isnt
>what is the most efficient
the question becomes
>whats the best lab to learn stuff i dont know yet?
>>
>>110369314
>>110369351 cont
ofc theres a gradient to maintain
but im thinking: what if we reframe the question?
>>
Are Godot developers allowed here?
>>
>>110369378
ofc
its daily programming thread, not daily godot hate thread
trying to act civil is the entry treshold, ig
key word: trying, kek
>>
>>110369351
>i think your problem is that theres a part of you that wants to do practical shit when another just wants to program for fun
yes and some masochistic part of me that wants to make things extra hard.
>>110369351
>>whats the best lab to learn stuff i dont know yet?
I was just considering this. I did buy the book "writing a c compiler" from Nora Sandler. While this books seems to be good, it forces you to write a lot of stuff yourself.
Maybe I'll start with this https://craftinginterpreters.com/
But in HolyC. I once started it in powershell, because it was bored and I think I made it until expr evaluation.
I just had to work around implementing the visitor pattern, but that was possible.
And if I can work through it, then it should teach me the shit in the vm part hopefully. Then I can move on to C or HolyC compilation
>>
>>110369423
>because it was bored
s/it/I/
(and I had no rights on my windows computer at new workplace and they gave me no tasks. Powershell was the only programming language I had available :^))
>>
>>110369423
>it forces you to write a lot of stuff yourself.
wym?
this doesnt sound like a bad thing

>https://craftinginterpreters.com/
i need some time to parse that

>I just had to work around implementing the visitor pattern, but that was possible.
>And if I can work through it, then it should teach me the shit in the vm part hopefully. Then I can move on to C or HolyC compilation
this i cant follow. yet
im would be reading craftinginterpreters now, but i have to finish refactoring my lib extractor
i used dirents, and im turning the thing to full string-based operation because i ddint anticipate my refactoring of my codebase would have such profound impacts on the underlying mechanics
but its ok. always lance the boil as soon as possible, otherwise thats tech debt that can only accumulate

ofc, comments everywhere so i dont need to think when im not-reading my code.
until i get where the action actually happens
>>
>>110369558
>wym?
>this doesnt sound like a bad thing
It's not. Thinking too much is hard for me rn. So I gotta take snail steps
>this i cant follow. yet
he used the visitor pattern to evaluate the expressions. What's that? Like virtual base class then just one for each type so you can just visit() and it dispatches to the correct class
>>
>>110369423
also
>yes and some masochistic part of me that wants to make things extra hard.
i think that part is called "ambition"
and its a good part, i think, bc its that part that makes you become better with time, aka- gain new skills. bc its another mountain to climb
>>
>>110369610
maybe similar to duck typing you could say
>>
File: 1788710305748533.jpg (54 KB, 736x690)
54 KB JPG
>#define WIN32_LEAN_AND_MEAN
>>
>>110369610
>It's not. Thinking too much is hard for me rn. So I gotta take snail steps
mh-hm
>>110369618

so youre rebuilding. probably from a hiatus period

dw, its all gonna come back
i think the key part is not to push yourself into burnout territory now
ive been there, ive done that
nothing worse than going back to code you mastered
failling at understanding it
or
trying to do stuff thats been trivial to you a while ago
and remembering nothing of it
in the end thinking youre degraded, by age, or by life fatigue

i can tell ive been down
for a good while

at a certain point ive pushed myself into epilepsy-light bc i tried to focus too hard when the moment wasnt right
recently i ve been thinking im just getting old bc i wasnt inspired as i usually were

but really- today proved me wrong.
im more efficient than i ever was.

one just has to take baby steps and build up to the optimum
then go beyond

the brain doesnt follow the same rules as the rest of the body
were on a downward slope after ~27, physically-wise
but we keep developing intellectually until our deaths. or dementia, whichever comes first

theres the personal/subconscious factor though
and from experience: ive ignored it way too often
>>
>>110369666
mr. satanic trips, whats your point?
>>
>>110369709
its cringe
>>
File: scrn_20261118_251221.png (7 KB, 640x480)
7 KB PNG
>>110369675
I think it's a mixture of the AI heroin trying to get me to take the next shot and just stupid depression making me unable to think.
It's hard for me to not fall for addictive stuff, but it's just not fun. Struggle is kinda fun.
>>110369618
>i think that part is called "ambition"
Maybe.
I mean I built a fucking risc-v assembler in HolyC that I also implemented a basic forth interpreter in. So that's kinda fun. But then the next anon comes around the corner and says
>uSe CaSe?!?!
Well, none. Except fun.
So I just try to stay abstinent from AI and get my brain back to normal again
>>
>>110369714
ngl, fair.
our trade is fertile grounds for all kinds of autism, doe
it just is what it is. and the autists provide value here
you dont sound like the type of anon who memorizes whole manuals for the sake of it...

some autists just enjoy absorbing meningful information.
some autists just enjoy abosrbing information full stop
>>
>>110369740
>So I just try to stay abstinent from AI and get my brain back to normal again
if that is something you have to do, then you have to do it

you gotta stay sharp.
bc the ai-subsidy will end at some point
bc you can be in situation where the network breaks down

bc you have self respect.

but mostly: because if youre not sharp, how are you gonna tardwrangle the shatbot into producing something decent, even when used as force multiplier?
>>
>>110369746
Shut the fuck up
>>
>>110369777
and what if i dont, mr script getter?
>>
File: discodiscopogopogo.jpg (237 KB, 3000x1167)
237 KB JPG
>>110369777
>triple digits
>trash post
how come??
>>
op here
find altchans
posting here isnt viable anymore

cya around. someday, somewhat
4keks turned full gay
>>
and all that for reviving dpt
mods dont want to have a dpt?
all is clear now.

/g/ is a vibeslop NIGGER board
with people drinking cum from a bottle

we are no longer acceptable here.
it is what it is

you want to be a class b shitizen here? then stay
im leaving. theres no point.

i still won, bc i always do
but everyone who stays here will automatically lose

this place is a complete fucking shithole
and now im leaving. mr. c
bc fuck this noise
and fuck niggerApe
i got better things to do than to evade
this is motherfucking retarded

enjoy your empty board, faggot fucking retard imbeciles
>>
>>110370015
>but everyone who stays here will automatically lose
there is no other place to go to.
See you soon
>>
>>110370015
coding is vibecoding, get used to it
>>
>>110370074
fuck 4 chan.
unfuckingironically

no place at all is better than 4 chan
ban me again so that it shows up in your jany tickets, whore

the only reason i came back is bc i genuinely have good feels for the community
but since epressing said good feels is impossible now
then ill fucking leave

you want me to leave.
you want an empty boring board.
who am i to disagree?
am i a mod?
if i were a mod id legit have a couple strong word of which at least one is "retard" and the other one is "fuckign", with you

what the fuck is wrong with you, nigger?
why do you want to kill the board?
>>
>>110370074
you know what
funny thing
but why are you even talking to me?

i think the stick i hold is that i can go to the irc and talk with the admins directly
and maybe i should

what about?
you fucking shartywhore

i think i know whats up
jany is a sharty fucking failure

and this is why you dont want me to escalate things further, isnt it?

or maybe shartyPEDOS (cuz theyre pedotrannies allright) feel rekt bc 4 chan community is too resilient

but this means we have a shartyPEDO jany fucking NIGGER in our ranks

report this, faggot
lets see what happens now lamao

fukken you went above the system
its associated with your name now

go the fuck ahead
lets see what happens
>>
>>110370074
you dumb subhuman fucking niggershit

you didnt even prevent me from posting here

how does it feel

and i want to hear everything.
every detail about how youre mad, and you want to kill yourself

i want to hear it all

you fucking inbred subhuman retard
tell me all about how it feels to be a retarded nigger subhuman fucking failure
>>
im still posting btw
what the fuck
i thought i was supposed to get rangebanned?
i thought im supposed to be evading?

this sounds less like a jany problem, and more of an infra problem, doesnt it?

you told me to shut the fuck up
whos shutting the fuck up now, faggot fucking nigger?
>>
ok, dpt/poll time

what do i do

do i go to the irc
or do i keep evading

poll closes in, idk, one hour or something

cast your vote!
>>
>inb4 fingerprinting
i didnt even start spoofing with vms

no, i wont tell you how to do that
but i will do that myself if i keep getting b& bc i hurt a niggerfaggot's snowflake's fee fees
>>
>soilence
i told you i always win
bc i always do
im too retarded to lose
thats how i routinely do shit thats supposed to be impossible to the likes of me

youre still subhuman though
like, literally- inferior by any metric
intellectually, in shitposting, and also physically

just go home, sharty fucking niggers
youre retarded. and inferior
its in your genes
there is no fixing that
fucking sue your parents for not having used a condom
short of thet, unironically, just kill yourselves.
jump in front of a bus. or shoot a shotgun into your heads. i dont fucking care to be quite honest
>>
>>110370303
I'm having ceremonial grade matcha rn
>>
>>110370310
>superficial shit used as cope for being a subhuman
in comparison, im pushing stats science forward

have your fukken green tea, but chiapanees (O.O expected ig. you see a big penis instead. may or may not be intended, but no, you cannot touch it)
>>
>>110370310
ackshually
the japanese are based

were compatible in our demeanors

but youre a sad faggot
go to japan, theyre gonna teach you manners
>>
key word: trying
although id guess all of dptposters are now on altchans ig

good fucking job in killing g further than it was already dead you dumb fucking imbeciles
>>
aight, cya
c-boi, out!

off to greener pastures
i guess you wont see the opencl lib after all
sory but this place is too much of a motherfucking shithole
>>
>>110363620
I asked grok what to learn next, and it suggested adding a blur to the ring with code I extracted into

float glow_mask(vec2 uv, vec2 center, float radius) {
float dist = circle_sdf(uv, center, radius);
float glow = exp(-abs(dist) * 6.0) * 0.6;

return glow;
}


and I can use it like

void main() {
vec2 uv = normalize_uv();
vec3 bg = vec3(0.03);
vec3 ringColor = vec3(0.5, 0.9, 1.0);
vec2 center = vec2(0.0);
float radius = 0.5;
float halfWidth = 0.01;
float ringMask = ring_mask(uv, center, radius, halfWidth);

bg = mix(bg, ringColor, ringMask);

float glowMask = glow_mask(uv, center, radius);

bg += ringColor * glowMask;

fragColor = vec4(bg, 1.0);
}


How does it work? Looking at the graph of
exp(-x)
on graphtoy, it's a quick falloff, I guess it's close enough to mimic how light works. It intersects the y axis at 1, so I guess the 0.6 is there to bring that down. If a > 1,
exp(-x * a)
squishes the curve on the x axis, so the falloff is faster. I think I can do

float glow_mask(vec2 uv, vec2 center, float radius, float squish, float peak) {
float dist = circle_sdf(uv, center, radius);
float glow = exp(-abs(dist) * squish) * peak;

return glow;
}


so the glow is proportional to the distance to the curve describing the glow, a ring in this case, since it's an exponential, it never quite reaches zero.
>>
>>110371152
I want to do something more with this. What about a pulsating ring on the center of the screen? I can do that. I can set the radius to
abs(a *sin(u_time))
, I can add a 0.1 so it doesn't shrink to a point. It works, but I was thinking of using this technique https://www.youtube.com/watch?v=6Qb6QtC6QMs and I think it could look better if there's some rest time. I can smooth between y = sin(x) and y = a.

But first I'll see what I can get. If I start with
f1(x, t) = abs(sin(x))
,
f2(x, t) = 0.5
, and
f3(x, t) = max(f1(x, t), f2(x, t)) - 0.1
, the 0.1 because I don't want it to reach the edge.

Can I pass functions as parameters in glsl? I don't think I can, but it's not like I need to for this

float smooth_max(float x, float y, float bias) {
float rad = sqrt(pow(x - y, 2.0) + bias);

return 0.5 * (x + y + rad);
}


then

float rad() {
float f1 = abs(sin(u_time));
float f2 = 0.5;
float bias = 0.1;

return smooth_max(f1, f2, bias) - 0.1;
}


How do I graph this? let's see, the thing I have to enter into graphtoy for this one is

f1(x, t) = abs(sin(t))
f2(x, t) = 0.5
f3(x, t) = 0.5 * (f1(x, t) + f2(x, t) + sqrt(pow(f1(x, t) - f2(x, t), 2.0) + 0.1))


the graph looks a bit too smooth, I'll set bias to 0.01.

How do I make it sharper? I want more time between releases, and sharper peaks. If a > 0, sin(a * x) squishes, so that's something, but I still want the space between the peaks. Why am I taking the absolute value? I can not do that and
smooth_max()
will take care of removing negative values.

I like the graph of sin(15 * x), but it's too fast. How do I get that sharpness but slower? How do you stretch a sine horizontally? multiplying it just changes the height. Raising a sine to an even power squishes the peaks. Fuck it, sin(x) ^ 20 looks good enough.
>>
>>110371163
PLaying around I think
float f1 = pow(sin(u_time * 2.0), 5.0)
looks good. Actually never minde, this looks goode

float rad() {
float f1 = pow(sin(u_time), 6.0);
float f2 = 0.2;
float bias = 0.01;
float yShift = 0.1;
float radius = smooth_max(f1, f2, bias) - yShift;

return radius;
}


Now I want to change the intensity of the blur. I think I can map the values. What was the logic for that again? it was like taking a percentage

float map(float fromStart, float fromEnd, float toStart, float toEnd, float value) {
float frac = (value - fromStart) / (fromEnd - fromStart);
float tot = toEnd - toStart;

return frac * tot;
}


then I can do

float MIN_PEAK = 0.1;
float MAX_PEAK = 0.6;
float MIN_RAD = 0.25;
float MAX_RAD - 0.9;

float radius = rad();
float peak = map(MIN_RAD, MAX_RAD, MIN_PEAK, MAX_PEAK, radius);


Can I change the colors as well? making it cold blue when it's small, and hot red when it's big? I could try to map the radius to it somehow, but I want to try using this https://www.youtube.com/shorts/TH3OTy5fTog I remember hearing of a site to visualize that formula. It was this http://dev.thi.ng/gradients, but it's dead now. Thankfully it's archived. So I have to fiddle with it until I get a pallete that goes from blue to red.

I can only fiddle with the inputs for long enough before I get bored, so this will have to do
[[0.588 0.268 0.408] [1.858 0.558 0.648] [0.408 0.628 0.628] [0.558 1.858 -3.122]]


How do I use it? I can copy it like it's in https://iquilezles.org/articles/palettes/ with the vectors hardcoded, but what do I do about the parameter? From the article it looks like the parameter lives in [0, 1], so I'll map the radius to that.

It doesn't look quite right. I'll do
[[0.588 0.268 0.408] [1.588 0.558 0.648] [0.408 0.628 0.628] [0.558 1.858 -3.142]]
instead.
>>
>>110369197
Im Bosnian and I want to learn to code
>>
>>110371246
Kill yourself, snailcatspammer.
>>
>>110371263
I was being honest
>>
why do people insist on writing compilers for imperative languages when you can have much more fun compiling functional languages
>>
>>110371594
how i feel with langs that have no C FFI
>>
>>110371594
>why write a compiler no one will use, when you can write a compiler no one will use but for a language no one will use either
might as well build screen doors that will fit a submarine
>>
I'm seriously tackling fixing the tearing/line artifacts in my GB emulator.
It's a stubborn bitch, though.
>>
IDK what the fuck I'm doing, how do you name variables? There seems to be a big focus on
1. keep lines at 80 chars, MAYBE some places say 100 is okay
2. clear variable names, no single char variables, clear function names with multiple words
I don't get what I'm supposed to be doing. Both camps seem obnoxious to me. I think you can fit 100 char lines on a 1080p monitor twice side by side. Also for the long ass variable name crowd, I don't get it because a lot of actual C functions are short as fuck, like fgetc. Is it named file_get_char? No, it's called fgetc. You can't have both, what should I actually focus on? I can't read another AI slop article telling me what to do I need you guys to fill me in
>>
File: qwen.png (23 KB, 1366x720)
23 KB PNG
Got another AI to so-to-speak playtest the language. (looks like qwen has a free trial mode and their cli is neat).
>>
I'm live.
Pls like share and subscribe. Thanks
>>
So SML looks stylish. This program is originally from a SML/ocaml book ported to Cosmos: https://pastebin.com/YV9Rr2Uk
It's why Cosmos has functors, basically. Idk what to do with this next any *ML experts or otherwise have an opinion
>>
>>110372260
160 chars with no blank lines for me, anything else is unreadable. I need to see the entire code at once.
As much reduction in syntax noise as possible. 2/3 letter macros, 1/2 letter variables preferred. Only important things get descriptive names, everything else is noise.
>>
test
>>
I compiled this code, but it does not use SIMD. Shouldn't it just load a,b,c,d and w,x,y,z into two registers and then add them. It does work when I am using arrays instead.

void sum4rest(int *restrict a, int *restrict w,
int *restrict b, int *restrict x,
int *restrict c, int *restrict y,
int *restrict d, int *restrict z) {
*a = *a + *w;
*b = *b + *x;
*c = *c + *y;
*d = *d + *z;
}


The assembly is the following.

0000000000000058 <_sum4rest>:
ldr w8, [x0]
ldr w9, [x1]
add w8, w9, w8
str w8, [x0]
ldr w8, [x2]
ldr w9, [x3]
add w8, w9, w8
str w8, [x2]
ldr w8, [x4]
ldr w9, [x5]
add w8, w9, w8
str w8, [x4]
ldr w8, [x6]
ldr w9, [x7]
add w8, w9, w8
str w8, [x6]
ret
>>
>>110372260
>1. keep lines at 80 chars
that's an extremely archaic practice from when people used computers in text mode instead of a graphical mode and horizontal scrolling was inconvenient
160-240 characters is a much more convenient limit nowadays
>2. clear variable names, no single char variables, clear function names with multiple words
the point of this is to make code understandable without having to mental map or otherwise memorize everything
with smart auto-complete modern IDEs have, it's actually faster to type verbose names than short-hands
>I don't get what I'm supposed to be doing
then just follow the convention whatever code you're using uses
short, cryptic names are common in C. in Java, verbosity is preferred.
>>
>>110373381
Why would it do that when you have all those values being passed to the array as discrete units?
>>
>>110373540
>array
Function.
>>
>>110371594
ok then how do I get rid of the obsession/dream of writing a compiler?
>>
>>110373545
Write one
>>
>>110373550
in which language? which target language?
>>
>>110373545
find something you would actually use if you wrote it
>>
>>110373564
Write a caml to x86 whole program (optimizing) compiler in ocaml.
>>
>page 9
almost as bad as hitler
>>
>>110375191
I blame the serbiansister
>>
>>110372260
>Also for the long ass variable name crowd, I don't get it because a lot of actual C functions are short as fuck, like fgetc.
C is ancient, don't copy it's naming practices. Use descriptive names. 80 char limit is from the days of punch cards, just makes the lines as long as you can comfortably read.
>>
FOLKS, please do not listen to her: >>110377791
she is clearly out of her mind and is most likely writing Java.
If you want good naming, just look at the Go std lib.
Thanks
>>
>>110373469
>160-240 characters is a much more convenient limit nowadays
You're allowed to use newlines, you moron. It literally improves the readability of things. We've known this for centuries from books; it's not like we don't know how to turn those on their sides.
>>
>>110378322
>most likely writing Java
Sounds more like someone who writes Rust in order to speed up her Python.
>>
Not sure if it's a /sqt/ question or not, but is SMT/hyper threading a potential security flaw because cores can potentially share resources? It seems like a side channel waiting to happen.
>>
>>110375605
Obsessed
>>
>>110372260
genuinely just take a look at existing source code and decide which is more readable to you, that's all there's to it. look at openbsd and plan9 code for example. plan 9 is very terse, you might not want to go that far but there's elegance and a system to it (rob pike has some notes on variable naming somewhere on the internet if you're interested)
I feel like it's a mistake to do the OOP style prefix_func thing that many people do (me included) because we do it just to appease some autocomplete shit or something... that's not a good reason.
>>
>>110381284
In SMT/hyperthreading the CPUs tend to have a set of registers per logical core, so generally the same kind of vulnerability is present.
>>
good morning sirs
let's reinvent the wheel sirs (Y A K S H A V I N G XD)
>>
>I often stil use
const uint8_t *mycock
even tho I know I want
uint8_t const *mycock

Why can't I just do it right? West const is the most confusing shit. It should not be taught
>>
>>110382970
In my PC it's let mycock = u8(123)
>>
What is the difference between an API and an ABI?
>>
>>110383367
One letter/word
>>
>>110369197
This guy doesn't program anymore
>>
Which one of the following qualifies as "AI-generated code"? and which one is the most practiced nowadays?
1) you use AI to learn the basic concepts, but do the actual work entirely yourself
2) you do the work yourself, then use AI just to review/improve the code
3) you try to do the work yourself, but whenever you have a problem ask the AI to solve it
4) you ask the AI to do the whole work, and you just review the code
5) you just ask the AI to do the whole work, and that's it
>>
>>110383560
4 and 5 qualify, 3 may or may not depending on how hard you try
>>
>>110383367
ABI is mainly about shared library compatibility, so you can have the same API with a different ABI, ARGUABLY you can have a different API with the same ABI (if you're counting things like different string constants passed in as part of the interface, you can change the constants while still having the same function that takes/returns strings), plus the forwards/backwards compatibility may differ (e.g. new DLL which is old DLL + a new function might still support the old ABI in addition to the newer one, or a newer DLL might leave in old functions for ABI compatibility)
>>
>>110384060
technically it could also apply to things like jit etc basically about the compatibility of code
>>
>>110370303
why do you write
like the lyrics
to a system of a down song
>>
>>110383560
>you try to do the work yourself, but whenever you have a problem ask the AI to solve it
This depends on if the AI generates the code and you use it, or it just breaks down the answer in normal language / pseudocode and you take it from there.
>>
woah, I think I just understood how to handle my own buildroot configuration.
Last year I started to copy and strip down some example code, but I think I understand now what I did. based.
I did a pretty good job, too.
Now I just need to put a TAG on my software and then I can just do make and my fucking embedded loonix app will get compiled
B A S E D
>>
>>110384060
How can API be the same but ABI still be incompatible? Doesn't all good API abstract away all the implementation detail. Why wouldn't an app developed on and OS with glibc x not work on an OS with glib <x provided the symbols are the same?
>>
>>110384635
"good" is doing the heavy lifting. A not-so-good API implementation would do poor compatibility checks, potentially leading to incompatible ABI
>>
>>110384635
>Doesn't all good API abstract away all the implementation detail.
That's exactly how.
>>
>>110384655
So, you're telling me the reason for not being able to have binaries on Linux is incompetence on the side of GNU devs and NOT because every distro is different?
>>
>>110369197
people say the factory pattern is le bad and they hate on java for it but wtf else are you support to do?
I have a async file manager library. it needs a callback to create a 'shared' state (i.e. allocate gpu memory for textures and gpu buffers, common hashmap for header files). also it needs a bunch of factory objects to make instances of parers (image parser, font parser, html parser) for each of the files you want it to parse. literally wtf else are you supposed to do?

like
File_Manager manager;
(each inherit from IParserFactory that make instances of Parsers)
manager.set_parsers(new Image_Factory, new Font_Factory, new ScriptFactory... x10);
manager.shared_parser_factory(new MySharedStateFactory);

unless you want to rely on static linking, but that is so weird for a library to require itself to be static and to have you implement a function as part of its initialization
>>
>>110385165
just try it out. You have nothing to lose
>>
>>110385165
>people say the factory pattern is le bad and they hate on java for it
Java didn't invent design patterns, and design patterns (specifically the GoF ones) weren't even designed for Java
people hate design patterns because they never build anything complex enough to warrant them, but typically in university courses you're told to shove every possible design pattern into a program even when there's absolutely no point in it

>unless you want to rely on static linking
those people are that dumb and stubborn that they will insist that it's better to hard-code it as a bunch of if-else's or switch-cases
>>
>>110384635
Dependency changed.
Compiler, compiler version or flags changed (and at a higher level, multiplatform libraries often have the same API between platforms but are totally ABI incompatible between them to the point nobody even thinks about calling that ABI incompatibility to begin with)
Everyone keeps moaning at MSVC to break ABI compatibility for a bunch of ancient bugs/missed optimisations, and its been broken for at least one function.
>>110385165
just write a function that returns conditionally on the input
but why are you doing that for file parsing anyway?
>>
>>110385165
make your own libraries so you aren't locked into patterns. Implement something you think is better / more intuitive.
maybe try a JVM lang that's not so OOP FactoryManager oriented
>>
>>110386350
Uhh sirs? Java has algebraic data types and pattern matching, not factorymanagerpoop
public class Main {

public interface EitherH<R,A,B> {
public R left(A a);
public R right(B b);
};


public interface Either<A, B> {
public <R> R match(EitherH<R,A,B> handler);

public static <A,B> Either<A,B> inl(final A a) {
return new Either<A,B>() {
public <R> R match(EitherH<R,A,B> handler) {
return handler.left(a);
}
};
};

public static <A,B> Either<A,B> inr(final B b) {
return new Either<A,B>() {
public <R> R match(EitherH<R,A,B> handler) {
return handler.right(b);
}
};
};
};

public static void main(String[] args) {
Either<Integer, String> ea1 = Either.inl(3);
Either<Integer, String> ea2 = Either.inr("fizz");

Either<Integer, String> ea = ea1; // = ea2;

System.out.println(ea.match(new EitherH<Integer, Integer, String>() {
public Integer left(Integer a) { return a; }
public Integer right(String b) { return b.length(); }
}));;
}
}
>>
>>110386372
grim lang
>>
>>110386387
do that in C++
>you can't
>>
>>110386404
What's wrong with
std::variant<int, std::string>
>>
>>110387088
that's not a rank 2 type
I guess C++ is just not very powerful
>>
>>110386350
its C++, I'm pretty sure it'd it be the same in all languages. like with double function ptrs instead of virtual functions in rust and c

>>110385982
its not parsing a 'specific' file. its parsing a directory like a gamefile map. the files in it get assigned an IParser instance and parsed in a specific order
>>
>>110369197
>java Integer is immutable
phew
that was a good design decision
>>
>>110388488
Why would you need it to be mutable?
>>
The most powerful programming language is Lisp. If you don't know Lisp (or its variant, Scheme), you don't appreciate what a powerful language is. Once you learn Lisp you will see what is missing in most other languages.
>>
>>110388506
nah i was just using the arraylist copy constructor and was worried the underlying integer objects have the same addresses
>>
>>110378322
>she is clearly out of her mind and is most likely writing Java.
I do not write Java. I usually write Common Lisp, but recently I have been writing x86-64 assembly (to make my own Lisp).
I did not say "make names as long as possible," I said 'descriptive.' That just means that the purpose of the function/variable/etc should be clear from the name (as opposed to nonsense names like foo and bar). Mainly I mean avoiding single letter variable names like math people like to do.

>>110385165
>people say the factory pattern is le bad and they hate on java for it but wtf else are you support to do?
The problem isn't so much the pattern itself, it's using it everywhere even when it isn't needed when simpler code without it would suffice. If you think it really is the best solution for your problem, then go ahead and use it.
>>
I need to program myself a girlfriend
>>
Cosmos is the ultimate language, surpassing Lisp.
>>
File: eyeroll.gif (1.34 MB, 560x315)
1.34 MB GIF
>>110388784
>The most powerful programming language is Lisp.
Ooooh! You're Turing-complete! Oh, how amazing!!!
>>
i know mojo is slop-oriented, but as soon as it gets sum-types, idk why you wouldn't use it
>>
Best introductory programming book?
>>
>>110371171
How does
mod(x, y)
work? Is it just like the modulo operator %? Looking at the graph of
mod(x, 2)
on graphtoy it seems like kind of. What does it mean to take the modulo of a floating point number? I've pretty much only used % to check if a number is even. Do I even understand the modulo properly? Let's see, I think this is what % does: If we have two numbers a and b, then
a % b = r
so that
b = n * a + r
, where n is the largest number of times we can fit a into b completely, and r is the how much there's left if we can't do it fully, so
14 % 3 = 2
because we can fit 3 four times into 14, and need an extra 2 to fill it up completely. What if
x < y
? That's x, but why? We can't fit any y into x, so the remainder is just x.

What does it mean to take the modulo of a floating point number? the glossary https://thebookofshaders.com/glossary/?search=mod defines the function as
x - y * floor(x / y)
. I want to get a more intuitive understanding of what that means. In the graph there's a 45 degree line that repeats, like the function returns the input for values between multiples of y.
>>
>>110391094
For y = 3,
f = x + 3 * floor(x / 3)
. Why does the graph repeat? Consider a value like x = 24. That value is divisible by 3, so there should be no remainder, and thus the function should return zero, and it does
24 + 3 * 8 = 0
. It will also return 0 for 27, but let's see what happens in between those values. For 25 and 26 the remainders will be 1 and 2 respectively, as expected. What happens in between? We can interpolate between the three points we have to get a line, but why not a curve? When 3 divides x cleanly in
x - 3 * floor(x / 3)
, it's the same as
x - 3 * x / 3 = x - x = 0
. What happens as x increases a bit? at
x = 24.5
we get
24.5 - 3 * floor(24.5 / 3) = 24.5 - 3 * 8 = 0.5
. And that holds for
[24, 25)
, that's why we end up with
y = x - 24
for that interval. And at
x = 25.25
,
mod(x, 3) = 25.25 - 24 = 1.25
, so the line keeps going until we reach another multiple of 3. And that's why the graph repeats. If y = 1, then we just get
fract(x)
.

Apparently the sign of
mod(x, y)
is determined by y. How does that work? I can see it from the graph, but let's see...

Assume
x < y
. Also assume
x > 0
. In that case
floor(x / y)
is 0 if
y > 0
, and -1 if
y < 0
, and in the later case
x - y * (-1) == x + y <= 0
since
x < y
.

Assume
x < y
and
x < 0
. If
y < 0
then
floor(x / y) == 0
, so
x - y * floor(x / y) == x < 0
. If
y > 0
then
floor(x / y) == -1
, so
x - y * (-1) == x + y > 0
.
>>
>>110391098
I think that's it for when
x < y
.

Assume
x > y
.

Assume
x < 0
. If
y < 0
, then
floor(x / y) > 0
, and
x - y * floor(x / y) < 0
since we are subtracting from a negative value. If
y > 0
then
floor(x / y) < 0
, so
x - y * floor(x / y)
should be positive if we assume the thing about y determining the sign of the final value is right, but how?
-y * floor(x / y)
is positive, so it should be greater than x for that to be the case... I don't think I'm good enough at math to prove it yet.

Assume
x > 0
. If
y < 0
then
floor(x / y) < 0
, and
x - y * floor(x / y)
is also something...

I don't think I can prove it, but I can see it's true from the graph.
>>
>>110382192
well shid
>>
const int NUM_ITEMS = 10;
Item items[NUM_ITEMS];

Why can't I do this in C++? It doesn't like using a const value as the size.
>>
I made my own vector in C. Now what?
>>
>>110392157
>my own vector
struct Vec2 { float x, y; };
>>
File: triangle.webm (3.86 MB, 800x1058)
3.86 MB
3.86 MB WEBM
playing around with raylib's rlsw.
Trying to build something that I can run on my risc-v hardware and on my desktop.
The renderer seems to work, but I don't have all the fance raylib functions yet. so either I have to learn about the opengl routines or get that raylib shit compiled with the sw backend
>>
are noobs allowed here
>>
>>110392926
nice. raylib 6.0 has now based af support for the software renderer.
now I can run it on desktop and hardware for FAST iteration speed
>>
>>110393079
yes btw. You can ask noob questions, but not stupid questions
>>
>>110392114
You've technically made a VLA there, and C++ doesn't have VLAs.
>>
>>110393105
>comic sans
based retard
>>
>>110393438
it's really comfy to read desu. Don't like other fonts anymore for koding
https://github.com/shannpersand/comic-shanns
>>
>>110391094
>>110391098
>>110391108
I didn't even know you could use code blocks like that
>>
File: button.webm (2.9 MB, 640x1138)
2.9 MB
2.9 MB WEBM
I remember why I stopped chasing raylib.
when you use the headless thing it doesn't work with normal inputs. You have to handle evdev you'reselves.
Getting there tho.
Now I just need to send data back to the remote, then i have all the needed fundamentals for my App (tm)
>>
>https://herbsutter.com/2026/11/21/c26-is-done-again-trip-report-november-2026-iso-c-standards-meeting-buzios-brazil/?utm_source=swedencpp
They didn't remove contracts fuaaaaaaaaark
in brighter news, illegible 0O literals
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2026/p0085r4.html
>>
vector_t func();

struct X
{
X(vector_t&& v)
{
auto x { v };
// ...
}
};

X x { func() };


This is legit right?
`func()` returns a `vector_t` by value, `X::X(vector_t&&)` binds and implicitly converts it to an rvalue, then `v` should MOVE to `x` yeah?
>>
>>110394737
>This is legit right?
Speak English properly zoomer
>v should move to x
No because its treated as an lvalue reference, you have to use std::move(...) or static_cast<vector_t&&>(...) on it
(Also less important but I think it's already an rvalue when func returns it, even if you don't put && in the return type)
>>
>>110394757
In fact I think (can't confirm) all function parameters are lvalues within the function body. Otherwise it wouldn't make sense to be able to modify a function parameter for example.
>>
>>110394757
>No because its treated as an lvalue reference
I love this language, but fuck, move semantics in C++ is so annoying.
There's like a million different ways your shit may or may not move.
>"Don't move! The compiler will do it for you!....but only in THESE particular cases. Hope you can remember them all!"
>>
File: IMG_20261121_175636_677.jpg (1.67 MB, 2268x3324)
1.67 MB JPG
Hell yeah, motherfucker.
We fucking cross plattform. That's how you build a dev env
>>
>>110393968
I figured they would work like single backticks on markdown.
>>
>somehow the go lsp kept recompiling the raylib project over and over again clipping CPU's at 100%
>I don't know if this is a neovim or lsp issue
>lets try something proprietary, if that works better
>install the software
>start it
oh-
>>
>>110394874
It's confusing but I think this makes sense, its the same as value parameters. Even though you passed a temporary into the function, it continues to exist for the lifetime of the function, so it's treated as persistent inside the function.
>>
>>110395025
Yeah that's a really intuitive way of looking at it, thanks
>>
>>110394908
raylib sucks big ass black CIA glowie dick.
Back to the drawing board. Doing it all by myself and I guess I have to refactor my previous app.
Wasted too many fucking hours again trying to make it better with some epic libraries. Libraries all suck. Always.
>>
File: images(28).jpg (8 KB, 225x225)
8 KB JPG
In PHP, @ is used to suppress errors, and $ is used to identify a variable.
>>
>weekend
>no one building anything
>>
>>110394428
>They didn't remove contracts fuaaaaaaaaark
What's wrong with contracts?

>in brighter news, illegible 0O literals
I thought C++ already had this (It's been a while since I last looked at C++). I hate the 'leading zero means octal' thing.
>>
>>110397027
>What's wrong with contracts?
Everything, reddit spacer



[Advertise on 4chan]

Delete Post: [File Only] Style:
[Disable Mobile View / Use Desktop Site]

[Enable Mobile View / Use Mobile Site]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.