![E-xyza](/img/default-banner.jpg)
- 61
- 32 345
E-xyza
Registrace 9. 12. 2013
Elixir Code casts brought to you by Isaac Yonemoto
Want to sponsor my videos? You can sponsor me on github sponsors: github.com/sponsors/E-xyza
Want to sponsor my videos? You can sponsor me on github sponsors: github.com/sponsors/E-xyza
The Process 4.2: Corner cases for GenServer.call
This video puts the messaging parts of GenServer.call from the previous video, with a discussion of what to happens when an unreliable or overburdened system called. The concepts in this video are core to the stability characteristics of applications built on top of the Erlang Virtual Machine.
The last video (GenServer.call basics):
czcams.com/video/aFCnE6lVUWE/video.html
The full "Process" playlist:
czcams.com/video/_ZpDR0wCRFQ/video.html
The last video (GenServer.call basics):
czcams.com/video/aFCnE6lVUWE/video.html
The full "Process" playlist:
czcams.com/video/_ZpDR0wCRFQ/video.html
zhlédnutí: 415
Video
protoss: evil and powerful protocols
zhlédnutí 541Před měsícem
This video is a release announcement for protoss, which is a library designed to make your Elixir Protocols easier to read, understand, and debug. hexdocs.pm/protoss/Protoss.html
The Process 4.1: GenServer.call
zhlédnutí 260Před 2 měsíci
This is a continuation of "The Process" series, where I talk about the basics of GenServer.call Full "The Process" playlist: czcams.com/play/PLf5mA1y1vDNn87lxJ4yCm4XyYPLUodaM4.html
You CAN do error payloads in zig
zhlédnutí 1,8KPřed 3 měsíci
How I do Error Payloads in Zig. This is a response to chat in @ThePrimeagen 's video on Zig czcams.com/video/DucriSA8ukw/video.htmlm4s Article covering the same subject: zig.news/ityonemo/sneaky-error-payloads-1aka
Client Timezones for Phoenix Liveview (update!)
zhlédnutí 444Před 6 měsíci
Let's get rid of the client hook from the liveview communication see the original here: czcams.com/video/_rPS2hGoFDs/video.html Thanks to twitter user @nmk for the protip!
Client Timezones for Phoenix LiveView
zhlédnutí 447Před 6 měsíci
This is a tutorial showing you the basics of communicating the client's timezone to the server, in Phoenix LiveView. Uses: JS integration, Phoenix Liveview hooks
Puzzle (Jan 2024) Solution
zhlédnutí 172Před 7 měsíci
Solution to a puzzle from Jan 2024. Puzzle: DNAutics/status/1752737751982645289
Zig FFI for great Justice
zhlédnutí 1,2KPřed rokem
How to do FFI in elixir using Zig, from a Zig point of view
ExTerm 0.2.0 status update: 22 Jan 2023
zhlédnutí 343Před rokem
ExTerm library: github.com/E-xyza/ex_term Robert Virding's io protocol: www.erlang.org/doc/apps/stdlib/io_protocol.html Poll on if I should break out IOServer DNAutics/status/1617349077116624897 Follow me on Twitter for announcements and Elixir-related quips! dnautics
fun2ms and ms2fun for elixir! Advent of Elixir day 22 (remastered)
zhlédnutí 298Před rokem
sponsor this library and my videos! github.com/sponsors/E-xyza match spec library on github: github.com/E-xyza/match_spec documentation on hex.pm: hexdocs.pm/match_spec/MatchSpec.html how to read ets matchspecs: czcams.com/video/CyhFgWWksQU/video.html Follow me on twitter for even lower-effort content, 280 characters at a time. DNAutics
How to send pastes to Phoenix Liveview in 2023
zhlédnutí 386Před rokem
link to phoenix-custom-event-hook npm package: www.npmjs.com/package/phoenix-custom-event-hook
Advent of Elixir 2022 summary
zhlédnutí 189Před rokem
Wrapup for Advent of Elixir 2022 and announcements! Music poll: DNAutics/status/1607168441101737984?s=20&t=WAPQf83vNSQV-WzdEE7Tdw Links to the ex_term project: github.com/E-xyza/ex_term hexdocs.pm/ex_term Follow me on twitter for updates about The Process videos and Apical DNAutics
OTP DNS queries in Elixir: Advent of Elixir day 24
zhlédnutí 179Před rokem
I show how to do DNS queries in Elixir! Music: Window Seat - Rainy Day takeo x Spencer Hunt lofigirl.com/blogs/releases/window-seat
Deep dive into term_to_binary: Advent of Elixir day 23
zhlédnutí 181Před rokem
learn how erlang serializes any data into binary content, and the few cases when it doesn't work the way you might expect. Follow me on twitter for even lower-effort content, 280 characters at a time. DNAutics
Ets table odds and ends: Advent of Elixir day 21
zhlédnutí 151Před rokem
Ets table odds and ends: Advent of Elixir day 21
Cluster singletons with the :global registry: Advent of Elixir Day 20
zhlédnutí 439Před rokem
Cluster singletons with the :global registry: Advent of Elixir Day 20
The quirky :queue module: Advent of Elixir day 19
zhlédnutí 217Před rokem
The quirky :queue module: Advent of Elixir day 19
Bringing up an elixir project in a peer node: Advent of Elixir day 18
zhlédnutí 232Před rokem
Bringing up an elixir project in a peer node: Advent of Elixir day 18
Hacking Protocols to do manual dispatch (and other naughty things): Advent of Elixir day 17
zhlédnutí 184Před rokem
Hacking Protocols to do manual dispatch (and other naughty things): Advent of Elixir day 17
Transactions with :global.trans : Advent of Elixir day 16
zhlédnutí 327Před rokem
Transactions with :global.trans : Advent of Elixir day 16
Deep-Dive into Elixir Errors: Advent of Elixir day 15
zhlédnutí 186Před rokem
Deep-Dive into Elixir Errors: Advent of Elixir day 15
Macro.Inspect - a tool for debugging macros: Advent of Elixir day 14
zhlédnutí 203Před rokem
Macro.Inspect - a tool for debugging macros: Advent of Elixir day 14
List.wrap - the function with superpowers: Advent of Elixir Day 13
zhlédnutí 232Před rokem
List.wrap - the function with superpowers: Advent of Elixir Day 13
Using the :peer module to start a BEAM virtual machine: Advent of Elixir day 12
zhlédnutí 251Před rokem
Using the :peer module to start a BEAM virtual machine: Advent of Elixir day 12
HOWTO implement a JSON protocol 3 ways: Advent of Elixir day 11
zhlédnutí 242Před rokem
HOWTO implement a JSON protocol 3 ways: Advent of Elixir day 11
Counters and concurrency: Advent of Elixir day 10
zhlédnutí 456Před rokem
Counters and concurrency: Advent of Elixir day 10
Binding - the debug tool you didn't know: Advent of Elixir day 9
zhlédnutí 217Před rokem
Binding - the debug tool you didn't know: Advent of Elixir day 9
BREAKING Elixir with protocols: Advent of Elixir Day 8
zhlédnutí 369Před rokem
BREAKING Elixir with protocols: Advent of Elixir Day 8
Disassembling BEAM modules: Advent of Elixir day 7
zhlédnutí 304Před rokem
Disassembling BEAM modules: Advent of Elixir day 7
Oh, common why not to use global thread local var which you can embed in error enum if you want? Code will be way more concise plus no ugly extra args in function calls
That's just rebuilding errno. Hidden stuff like that is typically a bad idea
excellent video
I love the way you break things down. Unpacking the inside vs outside of a GenServer brings so much into focus. Thanks ❤
It's such an important detail that the calling process exits, not the overloaded GenServer.
I wish developers from "other programming environments" saw this, digested it - and fell in love with the BEAM. Thanks for educating us on these details!
Sir love your videos, keep making them
Love these
Note that the implemented function is NOT a fully faithful recreation of what actually happens inside a GenServer.call function. For that, read the source! github.com/erlang/otp/blob/ee9628e7ed09ef02e767994a6da5b7a225316aaa/lib/stdlib/src/gen.erl#L219-L279 In fact, the code that I've written as-is contains a fatal race condition (this is why you shouldn't reinvent GenServers)! See if you can find it.
I enjoy trying to extend Elixir in interesting ways, and I love me a good StarCraft reference (I've named throwaway mix projects things like Zergling, SCV, and Firebat), but I can't help but think you're looking for behaviours instead of protocols. You implement their callbacks directly in modules implementing the behaviour, and there are no hidden modules being created behind the scenes. You do lose the automatic dispatch provided by protocol consolidation, but your behaviour module can do whatever it wants in its functions before calling implementations of its callbacks.
Protocols are behaviours!
maybe you can bring more about liveview for us.
Here for the starcraft references :-D
Alright! I dig it. So visually and ergonomically it's more akin to how one would implements in Java
Thanks for continuing this series again
When I first saw my subscription notification, I thought this was going to be a Starcraft review. :)
I often wonder how reliable libraries that plug so deeply into the "basics" are, though, and whether I'm not going to face some hard-to-figure side effects.
No side effects in this one! It's just protocols with a tiny bit of added code (the use statement only applies to its lexical scope)
Beautiful, thanks for the lib!
The integration of Process.exit is so elegant.
Glad to see you back! Yeay!!
this
The machine code responding to the payload needs is great and all. But writing and reading this kind of code isn't the best experience. I'd rather have payloads embedded in the error types if possible.
the guy has just proven you why you don't want the language to offer you such things. You have to carry that garbage around whether you use it or not and that garbage in the language accumulate very quickly.
@@programmerdvorak7032 It only accumulates if you want to. There's nothing stopping users from doing that manually in multiple ways in the current state of the language. Again, this is machine-efficient and it suck to read and write.
@@programmerdvorak7032 he also showed you don't need to carry it around if you don't need it. The language could add the payload only if you use it. Think of something like error.MyError(.{}) Just like printing, if you fill the struct it gets used, if you don't then it's compiled away. Zig's comptime would make this very easy.
I appreciate the workaround, but that’s all it is. With this approach you: * can return an error without setting an error payload * can set an error payload without returning an error * do not have error payload types associated with the error and are tied to one type for all errors But I believe there is a GitHub issue where the Zig maintainers agreed they are adding error payloads eventually.
> But I believe there is a GitHub issue where the Zig maintainers agreed they are adding error payloads eventually. I'm not sure why they would do that. The core team has already pointed out their concerns with error payloads, mainly that they're potentially slow: either pass large structs on the stack, or heap allocate (no-no), and redundant: can easily be implemented in userspace, as in this video, I also have an article on the subject (in next comment reply if not deleted). Error payloads: #2647
I searched for this video
I was watching that primeagen's video on youtube, read that chat, and saw this video. The explanation you did with godbolt was great. Personally I think error payload is just unnecessary, at least in this particular example. The users of the function could read the document, understand the error better and handle it the way they want it. This feels like too much work.
Agreed. too much for this example but if I made a "real-ish" example it would be too much code for a 10 minute video 😂 Imagine though for a parser, you could stash file/line/column in the payload.
I ran into an issue recently where I wanted to get an error payload when parsing JSON. The std library in zig does have a way to get info about where the json parser failed though, so you can still extract something meaningful to dump in a log or on-screen, it's just not super convenient. Definitely most cases where you're getting an error, there's not going to be any meaningful payload that needs to be scraped together at runtime, and not having it as a convenient feature might prevent extra memory leaks when you're off the happy path... But it still seems a bit strange to not have it when tagged unions in zig already exist.
@@nathanfranck5822is there a way to get logging from the std library?
ty
Thank you for the update. One more trick: you don’t have to pipe in bindings() because if you use dbg() without arguments it automatically uses the bindings 😉
I like `zoneinfo` as it uses OS supplied tables. Thus it is easier to keep them up to date if on something like Debian.
nice
Welcome back 🎉😄
So useful my friend I'm watching all of your videos 👏
At 29:15, why does Process.alive?(v) return true? By that time the heavy_lifting process has run Task.start() to send do_heavy_lifting and then it returned a pid, so it should no longer be alive, right?
Nope! The fun is running asynchronously and concurrently so the calling process (terminal) is free to continue even as the fun in the task is running
@@isaacyonemoto Thank you. I understand now...I forgot that it's returning the pid of the child process, which is going to block on the "receive" until it has receives something. And even if it were returning the pid of the parent process (self()), alive? would still return true because the parent process is the console process, which is also still alive.
Why is it called BEAM
Good heavens, what a detailed explanation.
Such a great demo!
Where is the next part?
Very deep and knowledgeable video. Please keep making these kind of videos in detail. Thank you 🎉
thank you👍❤
Remarkable FFI and great presentation - thanks Isaac!
Isaac you rock man
Wow, this is amazing!!! Thank you Isaac for your efforts
I'm using rustler but after this presentation I am really think about switch to zigler ^^
Bom dia.
Man, you are a real genious you've been helping me a lot . This could be used as semaphores among cluster nodes🙌
Great video. Keep going 💪
Loved it
boom
oh snap!
Very great video. Thanks! I found that third option very clever! Although the second option is indeed very clean and I couldn't agree more with the argument to lower surface area)
Very good video! Just started to learn Rust just because of a need to run CPU heavy tasks with Rustler.. I would probably try Zig with Zigler as well (even if I'll probably go with Rust anyway just because of the sake of learning since Rust seems to be more and more relevant in the job market). Just out of curiosity, do you know if Rust memory consumption leak as well?
`cons` and `snoc` has backwards arguments probably because it's better used when piping from another method that would return the `q` which is a nice pattern actually, I pipe all the time
They did't want breaking changes so that's why they left in `lait`
So cool
Really useful and fun, thanks.