I read the book clean Architecture. It has a great section near the beginning about programming paradigms where the author shows how you can implement all the OOP behavior in C. Very fascinating
@JoseDaviCorreiaPassos8 ай бұрын
@@СергейДехтярёв-ъ4нjust read again and you Will find the nome of the book
@cslearn30448 ай бұрын
Bruh @@СергейДехтярёв-ъ4н
@lowlevelcodingch8 ай бұрын
@@СергейДехтярёв-ъ4н He literally said it
@AbdessamadBelm8 ай бұрын
Can u please provide the full title of the book
@skeleton_craftGaming8 ай бұрын
People think this is some sort of Revelation, all of your OOLs compilers/interpreters are written in C [or c++ which's compiler was written in C originally]
@juanmamani21108 ай бұрын
absolutely agree with your phrase "you can do anything in C"
@garryiglesias40748 ай бұрын
No, you can't do "generics" (meta programming).
@filip145288 ай бұрын
@@garryiglesias4074 You could write a c program that inputs c code with generics and outputs c code
@gumz41838 ай бұрын
@@garryiglesias4074 the video is literally about implementing oop in C. You think the same can’t be done for generics?
@garryiglesias40748 ай бұрын
@@gumz4183 Show me. Make some template, please. (Some context: I program in C for more than 30 years, and I've done full GUI in OOP/C for video games in 1997... So you won't be taken by surprise...)
@RandomGeometryDashStuff8 ай бұрын
@@garryiglesias4074macro like arena_da_append?
@GaryChike8 ай бұрын
Very nice! Reminds me of an article on Quora on "Object-Oriented Programming in C: A Deep Dive" by Khanno Mikhail: "...there are actually THREE ways to accomplish OOP in C (aptly named): Open style. Pointer style. and GTK style (GObject style). There are also three ways to apply function/method polymorphism in C as well: Struct style. Disjoint style. and Interface style ..."
@miroaja19518 ай бұрын
BREAKING NEWS: c programmer discovers dynamic dispatch in the lord's year 2024
@Daniel_Zhu_a6f4 күн бұрын
Tsoding worked as a java programmer afaik. btw, most powerful dispatching i've seen was in languages that are not traditionally considered as oop ones (julia, some ML family languages), since it could dispatch on multiple arguments and switch between runtime and compile time.
@Do_It_Stupidly8 ай бұрын
I've been waiting for this for a loooong time😭
@garryiglesias40748 ай бұрын
But it's a well known knowledge since the 70's...
@zetroks8 ай бұрын
Это замечательно! С удовольствием посмотрел на всю эту дичь. На удивление это крайне просто работает. Никогда не пытался имплементить что-то такое в своей жизни, максимум все заканчивалось указателями на функции, по причине ненадобности. Но какой же классный видос
@user-hk3ej4hk7m8 ай бұрын
Wouldn't be a C video without a segfault 10 minutes in
@Brad_Script8 ай бұрын
you wouldn't be coding anything significant if you never get segfaults
@user-hk3ej4hk7m8 ай бұрын
@@Brad_Script Yes, in C you wouldn't. Anything remotely useful is segfault galore.
@araarathisyomama7878 ай бұрын
@@user-hk3ej4hk7m Is your OS a segfault galore?
@user-hk3ej4hk7m8 ай бұрын
@@araarathisyomama787 You must be confused, I don't develop OS'. Running production ready software is not the same as developing it.
@PhthaloJohnson8 ай бұрын
A very interesting idea and quite elegant implementation! It's rather amazing that hot reloading can work so well in a typed and compiled language like C that doesn't have much features. I wish modern languages put some thought on making this a feature because it is so convenient for creating web servers, gui's and other highly interactive and visual applications.
@Ray_uck8 ай бұрын
are the captions the live chat?? that's cool af
@СергейФёдоров-щ8ш8 ай бұрын
Why do I need a chat if I came to watch/listen to the streamer. The streamer is interested in this, but the audience is not...
@nothappyz8 ай бұрын
@@СергейФёдоров-щ8ш yeah this doesn't really make sense. Perhaps it's just a proof of concept
@adokce8 ай бұрын
@@СергейФёдоров-щ8ш exactly why it's great. if anyone cares, they can turn on the captions. they are not hard-embedded in video
@lolcat698 ай бұрын
@@СергейФёдоров-щ8ш Maybe, just maybe, it's because in a stream, the streamer talks with the chat, and reads it, and people recommend him to do X or Y and he tells why yes or why not to do it that way, and if you can't read that then it makes no sense? Just saying
@asakhar8 ай бұрын
Tsoding, you don't actually need a dynamic array for vtable, or even register it at runtime, just store it in global library plain array variable and define it inplace. This way "dynamicness" is achieved through loading the lib itself, you just recompile the lib itself and vtable gets reloaded, then you just resolve it like you already do with function symbols. This way you can add vtable entries, but can't reorder or delete stuff from that just like in your implementation. I can provide an example via PR but unfortunately can't find public repo of panim, please consider making it public so people like me can f around with it)
@chri-k7 ай бұрын
That's actually a very good idea
@neshkeev8 ай бұрын
It only makes sense to define the Task struct's function members to accept Task itself so it looks similar to `self` in Python and besides you can call other task's functions from a Task's function
@Daniel_Zhu_a6f4 күн бұрын
did you know that in python you can assign free functions to a class and they will become methods? it also works in reverse, you can assign methods of a python class to variables to circumvent runtime dispatching when calling methods, like this: ``` class A: def f1(self): print('A') class B(A): def f1(self): print('B') f1 = A.f1; b = B() b.f1() # prints 'B' f1(b) # prints 'A' ```
@shakkar238 ай бұрын
For the tag implementation, you can make the tag an enum, as well as make the data a union of pointers to the types that inherit it, this allows the vtable to be off of the heap as you now know the size in compile time, as well as you can use designated initializers to have a more well defined offset of all of the pointers for your vtable.
@Adoblem8 ай бұрын
😊😊😊😊😊😊
@StevenMartinGuitar8 ай бұрын
Honestly seeing classes and virtual methods implemented in C was really freaking cool
@john.darksoul8 ай бұрын
Where is the book, Zozin? Where is it? You'd never give it to an ordinary citizen!
@martinparrish53928 ай бұрын
There is no book, only Zuul!
@ThatGuy-fq8cn8 ай бұрын
Congrats you invented GObject
@DVRC7 ай бұрын
Looking at old codebases I've seen many cases of OOP in C: - Sun Pixrect is a low level library for drawing on the framebuffer, and for each framebuffer there is a different implementation. At the creation of a Pixrect object, it is dispatched with the function table to manipulate it - Still from Sun, X/NeWS has a graphics library called Shapes, that replaced the CScript (the PostScript graphic layer) + Pixrect combo, and it has plenty of macros to declare classes in C and dispatch all the methods. This package handles shapes, paths and framebuffers - At CMU, a preprocessor called "Class" was made for the Andrew project. It enriched C with Object-Oriented specific syntax (similar but different from both C++ and Objective C). I guess this was used for the Andrew Toolkit and other applications of the suite
@snowcrash-8 ай бұрын
I love your content dude it's just so good.
@AloisMahdal8 ай бұрын
A huge problem with OOP is that virtually all basic tutorials go right away into stuff like inheritance and abstract classes, but in reality you should avoid that as much as possible (use interfaces and composition in 99% of cases). Then there's a ton of stuff such as composition, solid and "OOP design patterns" and *some* part of Clean Code... Lot of it is actually useful and applicable to most languages, OOP or not.
@blastygamez8 ай бұрын
Nice, see all you need is C and a Tsoding
@OCTAGRAM8 ай бұрын
When Tsoding does C, it's not C but Ts
@kaotiskhund8 ай бұрын
Thank you! For inspiration and laughs! Proposal: maybe animals poop in various places. Abstract the toilet?
@SaidMetiche-qy9hb8 ай бұрын
Now your bottleneck is the compiler being slow lol
@MyriadColorsCM8 ай бұрын
Unfathomably cool.
@SeasonalMike18 ай бұрын
Why did i click this video. Obviously i'm not gonna watch a 2 hour video at 12:57pm, also i have to wake up at 7am for school.
@aemogie8 ай бұрын
am?
@sortof33378 ай бұрын
@@aemogie its literally 1 am. his brain is clearly borked. :)
@aidennwitz8 ай бұрын
how did not watching the video go?
@Maverick569128 ай бұрын
you're so lucky. I've to wake up at 6am 😢
@SeasonalMike18 ай бұрын
@@aidennwitz pretty cool, decided to watch a minecraft creepypasta at 2am instead :)
@alexw50934 ай бұрын
1:17:42 I could not stop laughing from this point on. Well done sir. Well done.
@pyajudeme92457 ай бұрын
"You can do anything in C" - Since (almost) everything is made in C, I guess you are right. hahaha If there are programming structures that are not available in C, one can write his/her own programming language in C, and call it something like "Python"," Ruby", "C++" or "Perl" - This is how it has been done since 1972. At the end stands (almost) always C.
@RandomGeometryDashStuff8 ай бұрын
59:15 by "no code" do you mean Node_graph_architecture (wikipedia)?
@theevilcottonball8 ай бұрын
I just discovered that Chat is in the subtitles. Make of that what you will.
@bbq14238 ай бұрын
The boilerplate in C for the animal example could have been a bit smaller if you would have stuck to what C++ does a bit closer. In C++ it would inline the dog and cat data into the same allocation as for animal, meaning Animal effectively becomes a "Animal_Methods**" with some extra data to the right of it. Dog and Cat would also need the vtable pointer in the struct definitions, but this could be mitigated via the use of the butterfly technique in the utility methods. Initialization code for the tags could also be simplified if you used the C++ approach.
@NotherPleb6 ай бұрын
Well, a understand where the gatekeeping accusations come from. When people ask that kind of stuff it's not like they don't know how to search on the internet, it's more what to search, they want some advice about where to start looking because they are overwhelmed. They want a good root concept that branches to other concepts to learn, if you start at a leaf it's confusing, and often you find your way up to the root yourself, but it takes more time and it's more painful. I guess they can search for that advice on the internet too, but if they come to you it's because they trust your advice.
@drdca82638 ай бұрын
56:06 : I don’t understand why registering task wait wasn’t just added to the task_vtable_rebuild procedure?
@matthijshebly8 ай бұрын
Professor Dr Tsoding, lead researcher in the field of Scatology
@RockyDesigne7 ай бұрын
Yo, very informative vid, you're a great teacher, thanks!
@satyajeetjena67588 ай бұрын
2 uploads in one day😮😮😮😮
@oserodal27022 ай бұрын
EOLang dude just rediscovered Smalltalk (without the images).
@pedrokalil44108 ай бұрын
Oh my god, you launched this video right as i am making async oop in C. Tho i am making it more as an general purpose language (i think i will create my lang and transpile to this subset of c i created)
@jannemyllyla12238 ай бұрын
This kind of code not only exists, it is being standarized (there is upcoming ble smart toilet profile).
@OCTAGRAM8 ай бұрын
The most advanced OOP in C was in IBM System Object Model
@thehady18 ай бұрын
I like this guy irl like this guy ! Keep it up bro
@constant_teen97747 ай бұрын
what is !g for at the end of search bar at 1:04:22?
@ahmadzaklouta7 ай бұрын
Do you have any videos explaining OOP in C and desing pattern from the beginning
@ahmadzaklouta2 ай бұрын
what is the name of the previous stream (the animation programming engine)
@santitabnavascues86737 ай бұрын
In fact C++ is just a huge template over C 🤣
@bbq14238 ай бұрын
Now that you have a way to run tasks in parallel.. Time for multicore support in nob?
@kibels8948 ай бұрын
Nice that turned out really clean.
@kikawet8 ай бұрын
Is there any source code access so far? I am struggling a bit following all these concepts about virtual tables and wanted to take a look into it directly
@SeishukuS128 ай бұрын
I played around with something similar a number of years ago, it's kinda fun... Not *super* practical, but fun. Though these days, I do still kind of lay out my data and functions in a similar manner, just without the "virtual functions"/function pointers... So if I ever become unlazy, I can just toss everything into classes and be with the hipsters and use C++. :D
@kibels8948 ай бұрын
Could you also solve it by getting the arena from the main executable's memory space? Or does that only ensure the pointers aren't unreachable, but they will still be garbage after reloading?
@zeno79058 ай бұрын
GATEKEEPER!! Give me the book NOW!!!
@gempf4 ай бұрын
which is the previous video from this serie?
@CoderDBF8 ай бұрын
Dude, seriously, I would buy your book.
@Nop_90h6 ай бұрын
you reinvented tweens! gz your prize is VELOSIPED
@z0rdex7017 ай бұрын
the folder name is magnificent
@ddruganov8 ай бұрын
it seems as though you do not use any kind of lsp, is that intentional?
@leshommesdupilly8 ай бұрын
Man, I can't wait to see c adding classes
@skeleton_craftGaming8 ай бұрын
C++ is not an object oriented language, you can do oop like things in c++ but when you strip away the abstractions you just get C [which is why it is so fast; I say in regards to objects specifically] A C++ programmer... Thats who wrote the Vtable wiki page...
@tandeepdas92118 ай бұрын
The best reply from the Gate_Keeper👍
@jiraibozo8 ай бұрын
0:08 The APNIM
@kenneth_romero8 ай бұрын
i tried doing this with specialized types with Odin but for a game framework. couldn't get it working though, probably misunderstood something.
@_ami_dad_32898 ай бұрын
using enum for indexs and naming of methods seems to be easier for me
@johnsonogbu86978 ай бұрын
I left python to be here. I want to know and learn how it all started. Thank you tsoding.
@ooichu_3 ай бұрын
Всё, что необходимо для реализации ООП в C, - это макрос container_of().
@error-45188 ай бұрын
zozin should write a book about how to google, name it "art of googling" or something.
@hubstrangers34507 ай бұрын
Thank you....
@velikanskaglava20878 ай бұрын
Thank you!
@Toby-ve6gp4 ай бұрын
wtf is the second half of the stream?! lmfao.
@ddruganov8 ай бұрын
1:14:33 bruh that caught me off guard
@чистюля-л2и8 ай бұрын
Как ты зумишь экран?
@RatanBasak-f8hАй бұрын
Why don't you build an OS
@aussie1144 ай бұрын
Yo just write 1000s more lines of code so you can do object.do_stuff() instead of do_stuff(object). OOP is a meme.
@delicious_seabass8 ай бұрын
Heresy!
@xProsek8 ай бұрын
13:18 ofc we know vtable ;P 26:33 maybe 2d and 4d to make it obv for newbies Thx
@skittle728 ай бұрын
hell nah💀
@xarax79508 ай бұрын
How did you make constructor and destructor in C ??? video is long ...
@IgneousGorilla8 ай бұрын
Probably malloc and free? Lol
@xarax79508 ай бұрын
@@IgneousGorillamalloc free MANUALY it's not a constructor and destructor !
@javierflores098 ай бұрын
@@xarax7950 how are constructor and destructors not manual, there's nothing automatic about them
@BetaChri53 ай бұрын
@@javierflores09well eg in C++ they get called automatically when an object enters/leaves scope, also the compiler derives default constructors for classes. That what they mean I think
@mjpthetrucker94852 ай бұрын
You will need pointers. 😂
@brambasiel8 ай бұрын
1:31:27 out of context zozin when?
@nil0bject8 ай бұрын
i hate that vtable thing. just use generic objects instead of reinventing the wheel for everything
@ceruleansky66705 ай бұрын
Just make an OS at this point that uses your own libraries and framework to create a system that does exactly what you want from the ground up.
@vkatasonov8 ай бұрын
Не буду спрашивать почем и откуда «стимуляторы», но программируя на Си всего полгодика чистого времени, понимаю, что с Си и сознание расширять не надо;)
@anon_y_mousse7 ай бұрын
Honestly, at this point it's kind of scary how similar my data structures library was to your OO in C code. Also, quite similar to the code I would hand students that asked for homework help in the chat room I frequented. For some reason, they were constantly asking for help with linked lists. So I wrote a joke implementation which perfectly demonstrated the concept and worked without any errors but was a giant stream of FOAD's in various forms and at one point even had a little poem. I really miss Yahoo chat rooms. Those were some of the best times I spent online. Even found a really awesome MUD through various people back then. I really wish I could remember the address or name of it because it was an amazingly detailed MUD that allowed you to dismember your enemies and even cook their bits over a fire. Who knows, maybe I'll write one myself. As to the original subject, I think you should write a proper animations programming language and implement a VM to run it. I already know you won't, but I think you should.
@VictorPK1008 ай бұрын
Do not try and read the book. That's impossible. Instead... only try to realize the truth. There is no book.
@TheBusttheboss8 ай бұрын
Based Emacs user.
@levvayner45098 ай бұрын
I have full control of what languages I use, what paradigms I use, etc. And OOP is not click-bait; it is a very logical way to program, creating analogies from the real world of objects that have properties and actions or methods. I didn't watch the whole podcast, but if you wanted to write your squares as OOP, The squares would contain their own position on the screen, and expose methods like Move(x,y) Color(color) and whatever else you'd want to do with them.
@BugbountyPOCs418 ай бұрын
i see arch with dwm
@walkertest75038 ай бұрын
Wait it's all struct...
@purpasmart_48312 ай бұрын
Always has been.
@YASYTU7 ай бұрын
And all that work for nothing. He should have stopped and thought about what he es setting out to do, to realize that this is a waste of time. You do not want OOP.
@leshommesdupilly8 ай бұрын
You should call it "c = c + 1"
@GiammarcoAgazzotti8 ай бұрын
very cool C stuff and a very good programming exercise as long as you just want to fiddle around and have fun. for any real world need c++ has you covered in a safer way already (and I'm sure we all know this)
@newbiex117 ай бұрын
it's not easy to just use c++?
@mashroom_8 ай бұрын
just use Vala bruv
@valshaped8 ай бұрын
Nice object oriented shitposting
@tianned8 ай бұрын
That’s so cool omg
@twitchy99488 ай бұрын
I lost it at 1:50:50 XD
@sabitkondakc91478 ай бұрын
I love C, however freedom has consequences.
@patchy-oss8 ай бұрын
no
@nyyakko8 ай бұрын
Pog
@OneMilian8 ай бұрын
I don't need as much specific programming paradigm's as i need good filenames and a clean order. Edit: specific
@JoshuaF.8 ай бұрын
what a da fu
@FrankTinsley8 ай бұрын
Wait so… OOP is good afterall??
@Protoex8 ай бұрын
Why do some people dislike OOP ? I'm aware of the problems related to performance, but other than that, I don't know.
@Randy_McShandy8 ай бұрын
Hot reloading AKA Shared Object Oriented Programming, we love SOOP