My First Zig Interface

  Рет қаралды 22,740

TheVimeagen

TheVimeagen

21 күн бұрын

LIVE ON TWITCH: / theprimeagen
Become a backend engineer. Its my favorite site
boot.dev/?promo=PRIMEYT
This is also the best way to support me is to support yourself becoming a better backend engineer.
Get in on Discord: / discord
Get in on Twitter: / theprimeagen
Got Something For Me to Read or Watch??:
/ theprimeagenreact

Пікірлер: 75
@Blaisem
@Blaisem 19 күн бұрын
1:25:30 It's funny that prime was watching a youtube video at 1.5x speed, and I am watching Prime at 2x speed, so the KZfaq video runs at 3x speed, and at this exact moment that youtube video has 3x speed highlighted on its screen.
@AloisMahdal
@AloisMahdal 15 күн бұрын
i could not understand the guy so i slowed down that part to 0.5 speed, making Prime kinda drunk
@Sj-7718_dev
@Sj-7718_dev 10 күн бұрын
I start to think about it in my head because I was like “No way 1.5 x 2 is 3” then i realised it was but was still confused then I thought “1.5 + 2(3.5) is more then 1.5x2(3)” now I’m more disturbed then anything.
@rosehogenson1398
@rosehogenson1398 19 күн бұрын
It's kind of based how interfaces in Zig are just structs and you have to raw-dog the vtable
@luizpbraga
@luizpbraga 18 күн бұрын
"inline switch" is a time-saver
@steveoc64
@steveoc64 5 күн бұрын
Most times, you can just use anytype .. relax and trust the compiler to enforce the interface contracts, and let you know if your code is missing anything. There is generally no need to re-implement interfaces from scratch. The compiler will do that for you implicitly
@MrKlarthums
@MrKlarthums 19 күн бұрын
There's going to be a certain type of developer who thinks the approach from the blog is really cool yet hates design patterns. This is literally a design pattern for Zig, but probably something you'd codegen instead of writing by hand because this is cursed, poorly maintainable code.
@blarghblargh
@blarghblargh 19 күн бұрын
not every pattern, but a lot of them are just a workaround for not having a feature directly supported in the language
@stgatilov
@stgatilov 16 күн бұрын
This is how interfaces were/are done in pure C, with some Zig specifics on top of it. All the boilerplate written by hand...
@AloisMahdal
@AloisMahdal 15 күн бұрын
i sort of assume that at some point (some size of Zig community), we're just going to have some library for creating interfaces... right? (not sure if it's possible with language like Zig)
@kenneth_romero
@kenneth_romero 19 күн бұрын
i'm doing the same thing in my project, though with Odin. been messing around with the reflect core library and specialized structs to achieve an interface to allow easier addition of mods to my game.
@marcomongalo3328
@marcomongalo3328 19 күн бұрын
How refreshing. A community with no one saying "First!"
@darukutsu
@darukutsu 19 күн бұрын
glad that only people who watch prime are well behaved gentlemen 🗿🎩☕
@tomislavtumbas8360
@tomislavtumbas8360 19 күн бұрын
Yeah, we yell CHROOT CHROOT CHROOT
@thesilverbot9439
@thesilverbot9439 19 күн бұрын
Sneaky one there ;)
@nathanfranck5822
@nathanfranck5822 19 күн бұрын
Zeroth it is
@AronOrri
@AronOrri 14 күн бұрын
First!
@blarghblargh
@blarghblargh 19 күн бұрын
Interfaces can be nice, when the language supports them, but I think they're just not something I'd really want to use unless the language directly supported them. I'd probably usually just use a struct of function pointers, and then only at library boundaries.
@ForeverZer0
@ForeverZer0 19 күн бұрын
I tend to agree. I have been writing a lot of Zig the past few months, and have encountered a few scenarios where an interface might be convenient, but overall I get by just fine without them using other features that are more idiomatic That said, It would be nice to see some Zig features that alleviated some of the pain in implementing interface-like types. I have gotten by using comptime features to enforce the contract of the "interface" (i..e. wrapper type), but it always feels kind icky.
@AndrewErwin73
@AndrewErwin73 17 күн бұрын
"somehow you got that joke wrong!"
@Chiramisudo
@Chiramisudo 12 күн бұрын
It's freaking insane how fast you move around in your code. I MUST learn how you do that. I would love to see you teach a course, or maybe you already have, on how you setup your environment to achieve those speeds. Particularly how to do DRILLS to increase keying speeds... Also, that's probably, at least in part, why you suffered from RSI. I can only top out at around 50-70 WPM, depending on the day, and never have issues.
@Chiramisudo
@Chiramisudo 16 күн бұрын
54:54 Nah bro, you be Zigglin.
@0xc0ffee_
@0xc0ffee_ 17 күн бұрын
Aren't there videos on youtube of previous work on this project in zig?
@Chiramisudo
@Chiramisudo 12 күн бұрын
1:24:50 LOL! I was already watching at 1.5x, so when you doubled your speed, I was then watching the nested video at 3x. A bit fast.
@alexpyattaev
@alexpyattaev 16 күн бұрын
When &dyn Trait in is a 2 hour session, and people still say rust is hard...
@Alguem387
@Alguem387 14 күн бұрын
Its not hard its just verbose
@dmitrysim
@dmitrysim 19 күн бұрын
It would be nice to have token leak section
@joeportnoy-qh9en
@joeportnoy-qh9en 11 күн бұрын
people say rust is difficult and it can be but zig is difficult in it's own ways. i would personally rather deal with the borrow checker.
@MrTechHaus
@MrTechHaus 19 күн бұрын
last++
@TankorSmash
@TankorSmash 15 күн бұрын
Wasn't there another video on the channel a minute ago? Something about 2000 people playing Doom at the same time
@TankorSmash
@TankorSmash 15 күн бұрын
Oh it's a main channel video
@bpunsky
@bpunsky 13 күн бұрын
zig is a quiche language
@christopher8641
@christopher8641 19 күн бұрын
For some reason the .Foo syntax of zig just wrecks my brain. Im all for low level control but I really don't care to implement my own vtable. Definitely seems like the language has a lot of other neat tricks though
@i-am-linja
@i-am-linja 19 күн бұрын
I really don't see what's so hard about it. It's just a struct.
@christopher8641
@christopher8641 19 күн бұрын
​@@i-am-linja I did not say anything is difficult. I said my brain doesnt read something well, and said the other thing is tedious
@AloisMahdal
@AloisMahdal 15 күн бұрын
I think the .Foo thing is just about enum (or tagged union, in the .Pointer case where Prime was confused). since it's a typed language, it already knows the type of LHS so if it's enum, on RHS you can just type the second part of enum name, which i think is actually pretty cool.
@benjamin7853
@benjamin7853 11 күн бұрын
Why is bro implementing binary search on a data structure where insertion is O(N) anyways 💀💀💀
@allanpaiz3348
@allanpaiz3348 19 күн бұрын
SECOND!
@ImmaterialDigression
@ImmaterialDigression 19 күн бұрын
What I'm learning is that I'm too dumb to learn Zig.
@TankorSmash
@TankorSmash 19 күн бұрын
Zig is great if you know C. There's very little affordance given to the developer otherwise. The compiler is not very delightful and the docs are barren, and hard to look up. But man does it run fast
@i-am-linja
@i-am-linja 19 күн бұрын
@@TankorSmash It was the position a few years ago (not certain if it still is) that while decentifying the docs is obviously a precondition to 1.0, it's unwise to do it _too_ quickly as a) while things are as unstable as they are all you do is double the churn, and b) a more accessible language means a large influx of new devs, which the existing small community might not be equipped to effectively help.
@lmnts556
@lmnts556 19 күн бұрын
Nah man, I code in C and when I look at the syntax of zig I would honestly rather keep coding in C, it is just so bad. Zig could have been great, but they messed up the syntax completely.
@TankorSmash
@TankorSmash 19 күн бұрын
@@lmnts556 Syntax is the most shallowest possible thing to complain about at least, what else do you not like about Zig? Errors-as-values is a a big step up IMO
@lmnts556
@lmnts556 19 күн бұрын
@@TankorSmash That is the exact reason why so many people ditched java, so no you are mistaken. If the way you write the code is bad it will turn away a lot of potential coders because they really can't be arsed to write it lol.
@salim444
@salim444 19 күн бұрын
learned Zig before C#. L take. But in all seriousness, Zig is great and you are cool prime. TOKIOOOOOO in Zig when with liburing
@AloisMahdal
@AloisMahdal 15 күн бұрын
59th!
@sloth19938
@sloth19938 19 күн бұрын
last
@user-mw3fp7qf1w
@user-mw3fp7qf1w 17 күн бұрын
I hate how verbose it is
@lmnts556
@lmnts556 17 күн бұрын
Same, I would rather just stay with C. Lots of YTers try it and just ditch it for c or other languages.
@zlice0
@zlice0 19 күн бұрын
this looks worse than c++ templates...
@theoriginyt4869
@theoriginyt4869 19 күн бұрын
Interfaces are more comparable to virtual classes, instead of templates. But yeah, Zig is VERY verbose, like now I know how a VTable works under the hood 😅
@lmnts556
@lmnts556 19 күн бұрын
Zig syntax feels like java, I hate it.
@gronki1
@gronki1 18 күн бұрын
have you seen Java
@lmnts556
@lmnts556 18 күн бұрын
@@gronki1 Yes, and writing it and Zig feel similar.
@user-sn9dy5sq1q
@user-sn9dy5sq1q 14 күн бұрын
​@@lmnts556not gonna protect zig syntax but how can it look like java 's
@lmnts556
@lmnts556 14 күн бұрын
@@user-sn9dy5sq1q It just feels similar to write, verbose and clunky.
@wondays654
@wondays654 11 күн бұрын
What specifically makes it seem "verbose" to you? It doesn't look more "verbose" than rust, C# or C++. I'm asking because I write Zig almost exclusively and haven't noticed anything verbose about it.
@noskillpureandy
@noskillpureandy 19 күн бұрын
last
1000 Players - One Game of Doom
15:42
ThePrimeagen
Рет қаралды 159 М.
Trying Zig Part 1
1:30:00
TheVimeagen
Рет қаралды 78 М.
Haha😂 Power💪 #trending #funny #viral #shorts
00:18
Reaction Station TV
Рет қаралды 14 МЛН
ОСКАР ИСПОРТИЛ ДЖОНИ ЖИЗНЬ 😢 @lenta_com
01:01
БОЛЬШОЙ ПЕТУШОК #shorts
00:21
Паша Осадчий
Рет қаралды 4,1 МЛН
The Linux Experience
31:00
Bog
Рет қаралды 347 М.
The Simple Solution to Traffic
5:14
CGP Grey
Рет қаралды 38 МЛН
Dave Ramsey's Life Advice Will Leave You SPEECHLESS (MUST WATCH)
16:40
FREENVESTING
Рет қаралды 11 МЛН
More Zig Learning
33:33
TheVimeagen
Рет қаралды 9 М.
Best C++ Game Wins $1,000 - Game Making Challenge
22:18
Barji
Рет қаралды 839 М.
YOU WILL NOT BELIEVE the engineering behind these bridges!
32:07
Real Civil Engineer
Рет қаралды 131 М.
I Parsed 1 Billion Rows Of Text (It Sucked)
39:23
Theo - t3․gg
Рет қаралды 66 М.
VIM APM   DYING TO DETAILS1
3:00:04
TheVimeagen
Рет қаралды 13 М.
Why I Use C | Prime Reacts
13:00
ThePrimeTime
Рет қаралды 132 М.
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2,3 МЛН
В России ускорили интернет в 1000 раз
0:18
Короче, новости
Рет қаралды 411 М.
How To Unlock Your iphone With Your Voice
0:34
요루퐁 yorupong
Рет қаралды 27 МЛН