Calling Javascript From My 16bit VM | Live Rust Programming

  Рет қаралды 767

Tom Marks Talks Code LIVE

Tom Marks Talks Code LIVE

Күн бұрын

It turns out that calling Javascript is complicated! I need to rework my system call interface, then find quite a few fun borrow checker quirks to make this hard. It turns out this is way more of a rabbit hole than I expected!
Stream date: 2024-06-25
Support the stream: ko-fi.com/tomm...
Source: github.com/phy...
Streamed live @ / tommarkstalkscode
Follow me at coding.tommark...
Email: tom@tommarks.xyz

Пікірлер: 2
@valshaped
@valshaped 2 ай бұрын
22:48: The borrow checker is smart enough to know you can split a struct into multiple borrows. ``` struct Ctx { vm: VM, handlers: HashMap } let mut ctx = Ctx { vm: VM::new(), handlers: HashMap::new() }; let vm = &mut ctx.vm; let handlers = &mut ctx.handlers; handlers.get_mut(1).and_then(|h| h.handle(vm)); // This is OK, because man.vm can never overlap with man.handlers ``` There's also pattern-destructuring syntax if you want to be even more explicit: ```rust struct Manager { vm: VM, handlers: HashMap } fn do_the_thing(manager: &mut Manager) -> Result { let Manager { vm, handlers } = manager; // vm: &mut VM, handlers: &mut HashMap let handler = handlers.get_mut(2).unwrap(); // handler: &mut Handler let arg = vm.registers[0]; handler.handle(vm, arg) } ```
@TomMarksTalksCodeLIVE
@TomMarksTalksCodeLIVE 2 ай бұрын
I keep being surprised by how clever the borrow checker is!
Proxying Mutability in Javascript | Live Rust Programming
1:09:07
Tom Marks Talks Code LIVE
Рет қаралды 226
How Big Tech Ships Code to Production
0:59
ByteByteGo
Рет қаралды 456 М.
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 55 МЛН
Как мы играем в игры 😂
00:20
МЯТНАЯ ФАНТА
Рет қаралды 3,3 МЛН
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 402 М.
JavaScript Visualized - Event Loop, Web APIs, (Micro)task Queue
12:35
CPU vs GPU | GPU Programming | Episode 1
9:28
Simon Oz
Рет қаралды 10 М.
The Simplest Tech Stack
9:38
Awesome
Рет қаралды 120 М.
The New Option and Result Types of C#
15:05
Nick Chapsas
Рет қаралды 70 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,7 МЛН
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 87 М.
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 39 М.
Building a Compiler - Fixing Tokenizer and Lexer Errors
1:21:51
Tom Marks Talks Code LIVE
Рет қаралды 326
哈莉奎因怎么变骷髅了#小丑 #shorts
00:19
好人小丑
Рет қаралды 55 МЛН