ERRATA - Check out today's sponsor:quadratichq.com/? - Sorry about my voice in this video, I've delayed publishing for a month due to getting over Covid, and I simply can't wait any longer! I am totally fine (got all vaccines), but my voice is still croakier than I'd like! - 'Geocache' is missing the final 'e' in example 1. - 9:20 I LOVE Red Means Recording, Jeremy's videos have been an inspiration to me as a musician and video maker for years! In addition to the pinned video at this timecode, I made a few 'RMR'-style videos, my favourite of this is my cover of Love on a Real Train: kzbin.info/www/bejne/jWLQlpinhreFaJo - Do check the markdown source for all links, butthe typestate pattern article is here cliffle.com/blog/rust-typestate/ - 8:56 variants is misspelled (and likely in other places too, freakin' schwas ruining my day!)
@RenderingUser6 ай бұрын
Days since last errata: 0
@kyay106 ай бұрын
"(got all vaccines)" hopefully you got super-autism now!!!
@kveonlichman29176 ай бұрын
8:56 variants is misspelled
@Jianju696 ай бұрын
Nobody notices your voice is slightly different.
@NoBoilerplate6 ай бұрын
It's actually the other way around, autism causes vaccines! Here's my video on autism btw: kzbin.info/www/bejne/epm8ZJmrYr6afrc
@annotated_6 ай бұрын
My headcannon is that every video on this channel are just snippets of Seth rambling about random topics to his friends.
@NoBoilerplate6 ай бұрын
Funny story, that's *ALSO* half of what Lost Terminal is! (have you heard about this engine that burns Iron? Or this cool story from the early internet? or about this weird amateur radio trick? etc!)
@half_invisible6 ай бұрын
@@NoBoilerplate Great show! I've been enjoying it! Just wanted to let you know that the recap section on the website is two seasons out of date (well, three if you want to recap season 16 before it's released ;D).
@RustyNova6 ай бұрын
... And the shampoo bottles
@ved_s6 ай бұрын
In the alternate timeline, where Seth knows Rust
@NoBoilerplate6 ай бұрын
There's already rust easter eggs in Lost Terminal.... 🕵️
@dronicx79746 ай бұрын
I've been subconsciously doing CDD the entire time I've beed doing Rust. Before learning Rust, I worked with Typescript wayyy too much and from there I subconsciously learned to let the type system handle a lot of runtime checks. In TS land, this doesn't help (hence my many frustrations with TS) because the types are literally a facade. Rust actually not letting you run a program until you fix ALL type issues beforehand and Rust having an extremely complex and easy to use type system is what makes CDD viable and enjoyable in it. I highly doubt CDD in many other compiled languages would be as fun and model-asserting as Rust.
@NoBoilerplate6 ай бұрын
RIGHT! Rust Doesn't have features that other languages dont, but it makes them coherant and MANDATORY!
@minnow13376 ай бұрын
i just picked up go and its definitely not
@olafschluter7066 ай бұрын
@@minnow1337 You can just as well choose JAVA or Kotlin or Swift. The main difference between those languages and C/C++/Rust is: you do not have to worry about memory management (with a Caveat when using languages like Swift or Objective-C which do reference counting instead of garbage collection). You can create data structures on the fly without feeling the cost to do so, but when measured vs. algorithms where developers do care about memory management (and Rust forces them to do so), you will find that your code performs worse by magnitudes: using more memory (by a lot) and more CPU time (by a lot). Which is even a cost factor when your code runs in the cloud.
@b_dawg_176 ай бұрын
Every new pattern or feature of Rust I learn from these videos feels like a glimpse into the future of programming. This feels like what programming should feel like, and it's incredibly satisfying.
@NoBoilerplate6 ай бұрын
Thank you! This is why I can't *not* make these videos raving about this language. and it's #19th most popular in the world! YOU CAN GET PAID TO WRITE THIS!
@jofla6 ай бұрын
You know there are lots of languages that already achieve the same? Rust is not discovering "CDD" and some could argue that is not the best at doing it too
@b_dawg_176 ай бұрын
@@jofla I honestly don't know of any. Do you have any examples?
@NoBoilerplate6 ай бұрын
I don't need Rust to be the best at it. I'd be writing Haskell or another ML language if I cared about 'best'. I want my language to be popular and powerful. Go is the former, Haskell is the latter, Rust is both. redmonk.com/rstephens/2024/03/08/top20-jan2024/
@NoBoilerplate6 ай бұрын
My assumption is that they assume compiled languages are all the same, which is reasonable if you've not tried an ML or Haskell style type system before!
@qexat6 ай бұрын
"When you think about it, tests and types are similar" next step is having an embedded proof assistant DSL in Rust and it will unify the two :D
@NoBoilerplate6 ай бұрын
ugh, I'd LOVE that! Excitingly, it's absolutely possible to do so, someone just has to write a complex enough macro! (deptypes has the right idea: lib.rs/crates/deptypes)
@qexat6 ай бұрын
@@NoBoilerplate My reply got deleted (probably because of links) but there is also an interested project - based on a paper - called RefinedRust!
@lorenzn56016 ай бұрын
@@NoBoilerplate There is also prusti which has pretty good tooling (which is a problem I usually have with most for research software)
@NoBoilerplate6 ай бұрын
oh cool! What makes me excited is that whatever is built can be written as simple libraries using the macro system!
@vasilvass6 ай бұрын
@@qexatKani would be quite close to that
@69k_gold6 ай бұрын
What I love about Rust is the compiler gives so many errors that, once we are done fixing our mistakes, there's no room for bugs, unless our logic was wrong in the first place
@NoBoilerplate6 ай бұрын
if it compiels, it works!
@olafschluter7066 ай бұрын
My experience with Rust is that, if you spend time using the debugger at all, it is for finding flaws in your algorithm, whereas in C and C++ it is more often to find flaws in your data (i.e. memory) management or other pitfalls of the language (like why this goddammend template does not compile, but pesting me with totally inconclusive error messages instead?) . This not having to deal with the pitfalls of a programming language is what makes me fond of Rust, and enjoying to do programming in it as a hobby. I love things that get me focused to work on real problems, not tool issues. As I want to think on algorithms, not tools.
@VimCommando6 ай бұрын
This is such an amazing pattern I stumbled into last week. When refactoring Rust code, like changing the return type or number of arguments to a function, the compiler immediately tells you the exact location of each breaking change you need to fix. It is awesome 🤩
@NoBoilerplate6 ай бұрын
The compiler is so helpful!
@NickAc6 ай бұрын
loved the Red Means Recording reference!
@NoBoilerplate6 ай бұрын
Jeremy's a great guy!
@CarpPinePlays6 ай бұрын
This wasn’t a connection I was expecting, but I can’t say I’m disappointed! 😊
@NoBoilerplate6 ай бұрын
I mean, I'm much poorer (financially) because of how much I love his channel, but I'm rich in synthesisers 😀
@NickAc6 ай бұрын
@@NoBoilerplate haha, that's the spirit!
@meltingmug4 ай бұрын
This further affirms my theory that every channel I watch on KZbin is related in some way. I should make a data visualization for that, now that I think about it.
@connorgreene88346 ай бұрын
A few months ago when you started your Rust Videos, I remember hearing the pure joy in your voice while you explained it all and that was the reason I went on the journey to finally becoming a full time rust dev
@infernussynek64396 ай бұрын
You are one of the fewest (if not any) people on KZbin i watch immediately any new video i see. Thank you for doing good work and for the spark of the unusual your channel carry compared to the copy-paste, soulless corporate content so abundant on KZbin.
@NoBoilerplate6 ай бұрын
Thank you so much, I really appreciate you saying so ☺️
@mysterry20006 ай бұрын
Oh man you're finally back! Imma grab my popcorn and enjoy you tell us the best things about Rust 🍿 Thanks for being with us!
@NoBoilerplate6 ай бұрын
I'm sorry it's taken so long! RSI is a hell of a thing - I'm on the road to recovery finally :-)
@mysterry20006 ай бұрын
@@NoBoilerplate Nah dw about it! Whether it's you taking a break or you gifting us a video, all of us are glad you're here either way 😁 Loved the video btw! the TypeState pattern literally had me going all 🤩
@nicholas_obert6 ай бұрын
One thing to always keep in mind, and I'm guilty too sometimes cause I'm lazy, don't ever push your code assuming it's sound just because it compiles. Logic errors are always behind the corner and hiding under the carpet. This is why tests are also a good practice. For large projects it may be worth the effort to create a rich development environment with automatic testing tools specific to the job
@NoBoilerplate6 ай бұрын
Totally agree. For me, CDD is the whiteboard, TDD is the prototype, and functional testing gets you to production. But you must START with CDD 😀
@aks-f2y6 ай бұрын
@@NoBoilerplate Hmm I see, maybe I'm wrong but this video gave the impression CDD completely replaces the need for testing. I might be wrong! But then maybe testing is limited to logic errors and it's fully unnecessary to test anything else -- which is still amazing. Can you comment on this? 😄
@olafschluter7066 ай бұрын
That is why Rust makes writing tests so easy and executing them so accessible in all IDEs. Being a system programming language, where the ultimate goals are both correctness and performance, having a expressive test set is essential, as it allows you to verify whether your optimisations tried are sound or not in an instance. So I am more of a TDD guy. But I do not write any tests for a function until i believe it will work. Which it doesn't most of the time.... but fixing things in Rust is easy then, as every feedback of your toolchain is so conclusive.
@asdf8asdf8asdf8asdf6 ай бұрын
Thanks!
@NoBoilerplate6 ай бұрын
My pleasure!
@twenty-fifth4206 ай бұрын
"I want to roll for a new boilerplate upload.' "Roll it." "Nat 20." 🗿
@NoBoilerplate6 ай бұрын
I'm sorry it's taken so long! RSI is a hell of a thing - I'm on the road to recovery finally :-)
@twenty-fifth4206 ай бұрын
@@NoBoilerplate For better or worse, I stopped keeping up with code tubers since I have been on my own project (fantasy console) and writing for a novel. I have reached the point where my code feeds into my writing and vice versa lol. Plus, glad to see you recovered
@raphaeld92706 ай бұрын
@@NoBoilerplate Hopefully you have a more ergonomic setup. Not sure about you, but switching to a split keyboard with a vertical mouse in the middle of the two halves helped me a lot when I began developing wrist pains. Oh, and good wrist rest pads too.
@NoBoilerplate6 ай бұрын
many thanks for the tips! my stupid self-imposed 16-hour days gave me RSI even using a split kb and mouse! oops! breaks saved me!
@computerfan10796 ай бұрын
Get better soon Triss! Your quality just keeps on being great, incredable work!
@NoBoilerplate6 ай бұрын
Thank you so much! Regular breaks are the core of my recovery!
@TheFireMage1006 ай бұрын
This might be the most complicated yet subtle No Boilerplate video Ive seen, or maybe I just havent had enough coffee yet. Definitely glad for the .md documents because I can tell pouring over those is going to be very useful
@RenderingUser6 ай бұрын
bro finally uploaded, and within just two monthly polyphasic sleep cycles
@NoBoilerplate6 ай бұрын
RSI + Covid are a hell of a thing to get at once! Both getting better :-D
@RenderingUser6 ай бұрын
@@NoBoilerplate no way. you got covid after all the covid hype ended?
@hanifarroisimukhlis59896 ай бұрын
@@RenderingUser Looking the other way doesn't magically make the virus disappear. (That's kinda why i still put precaution till this day)
@rantingrodent4166 ай бұрын
@@RenderingUser Yeah unfortunately the actual virus is unaware of its hype status and continues to do its thing despite how hard we're trying to pretend it isn't.
@NoBoilerplate6 ай бұрын
The good news, if my personal experience is anything to go by, the trend for plague viruses to get less deadly and more contagious certainly seems to be the case with the variant I got. I almost didn't notice it for the last 3 weeks, unless I did anything strenuous on that day (then I'd be strangely tired)
@Leafygreens486 ай бұрын
THE BROTHER DROPPEDDD!!!!!! 🐐🐐🐐🐐
@NoBoilerplate6 ай бұрын
Rumours of my death have been greatly exaggerated :-P
@sambazeley53666 ай бұрын
This channel is incredible. Thank you so much! I feel like my rust code gets better every time I watch one of these
@NoBoilerplate6 ай бұрын
Thank you! Heh, my code gets better every time I make one of this videos!
@dylancode6 ай бұрын
Rust's compiler is honestly just so great. I really hate the move towards dynamically-typed and interpreted languages like Python - you sacrifice so much and gain so little. Keep up the excellent videos!
@NoBoilerplate6 ай бұрын
There's a killer feature for interpreted language - state preservation between code changes. The browser and how you use python for ML are two HUGE applications. But yes, if you don't need a long-running interpreter, it's time for Rust!
@jordixboy6 ай бұрын
you gain so little? meh I think then you dont actually what you are talking about.
@red_roy6 ай бұрын
different languages are best for different applications. python is the second best for all applications ;)
@papakamirneron25146 ай бұрын
@@red_roy What's n°1? Haskell?
@donaldtrump26 ай бұрын
@@red_roy you just contradicted yourself with your second sentence.
@HeraldOD3 күн бұрын
Love the nod to Red Means Recording
@ahuman324786 ай бұрын
I was wondering if you could make a video discussing how to shift from OOP-oriented thinking to whatever system works best with Rust. I've watched your "Rust data modeling with enums" (or whatever it's called) video, but I don't really think it shows what to use instead of OOP, rather it just shows how useful enums are. OOP structured programs have a graph-like structure, and it's pretty difficult to implement graph-like data structures in Rust. Glad you've had a smooth recovery from Covid, and excellent Rust video as usual
@NoBoilerplate6 ай бұрын
Re-watch that video, the part that allows the graph-like thinking you hope for is the normalisation section. Think of it as tables in a database, not animal genetics. It took me a long time to unlearn OOP, python helped me, Haskell was revolutionary, Rust finished my path ☺️
@ahuman324786 ай бұрын
@@NoBoilerplate Alright. By the way, when I talk about "graph-like structures", I'm not referring to inheritance, I know that it's bad. Rather, I'm talking about the ability to have different objects directly referenced by various others as many times as you want. In Rust, you can only have one owner of a (mutable) reference normally to ensure program validity, but it's very limiting. I'm trying to program a transportation network where it would be nice to have one object be owned multiple times, but solutions like Rc make the program look ugly and much more complex. I assume Rust is purposely designed this way to discourage the patterns I was using. To avoid this, I decided to assign items IDs and created connections between transportation sites using their IDs rather than direct references. Is this in line with what you were trying to communicate in your video? Thanks
@NoBoilerplate6 ай бұрын
I think you're on the right path, here's how to fix your complexity issue - abstraction. Use Rc for the plumbing of your code, but abstract that complexity through layers of your code. Imagine a web server like Actix or Rocket or Axum. You better believe they're using some GNARLY clever stuff behind the scenes, but I as the web developer never see that, because they've abstracted it away from me, as they damn well should. unsafe abstracts pointer access, String abstracts bytes - to program is to compose layers of abstraction. Refactor with that in mind, and you'll find your solution. Same as in any language, I bet! Good luck - come ask for help in my discord if you need it, there are far smarter folks than I there ☺️
@kellybmackenzie6 ай бұрын
Awesome video! Haskell's abd Rust's amazing type systems have made CDD the norm for me too. It feels awesome!
@NoBoilerplate6 ай бұрын
SUCH a comfortable way of living!
@greyw0lv6 ай бұрын
I really enjoy your videos, because of you i dipped my toe into rust between semesters last spring. I should have more free time soon to properly make something with rust.
@NoBoilerplate6 ай бұрын
So exciting! Make sure to run `bacon clippy` while you code 😀
@tgirlshark6 ай бұрын
the typestate pattern is really really cool and I want to see it being used more, I wish the language had a more streamlined way to write those tho
@NoBoilerplate6 ай бұрын
There's always way to improve things, certainly, but it's the best language for concisely expressing the typestate pattern that I have seen!
@RustyNova6 ай бұрын
I could see having a derive macro that would automatically generate the states. You would define all the states and content using an enum, and it would generate from it. For the impls I don't know enough to tell how, but a simple attribute above a function to filter only some states could be great.
@NoBoilerplate6 ай бұрын
Yeah, a simple macro would do it. That'd be cool. My Light example is the absolute simplest I could boil it down to - using it with traits (as the Cliffle article shows) is the best way to do it, and there's a bit more boilerplate there. some work has begun already lib.rs/crates/typestate
@kintrix0076 ай бұрын
How about Haskell, though? What I love about Haskell is that the compiler can actually ensure that the only valid type parameter you can apply to Light are On and Off. The equivalent of Light would be a compiler error.
@hanifarroisimukhlis59896 ай бұрын
@@kintrix007 In that case, you can't actually *make* Light because the new() method is only defined for Light I mean, you _can_ declare a variable/field of having that type. But you can't actually assign anything to it, making it practically useless.
@RolandHaller6 ай бұрын
I practice ADD Attention Driven Development. Basically I follow my fancy until I get to a state that does not motivate me anymore. Once again great video.
@NoBoilerplate6 ай бұрын
Thank you so much! Also, you should check out my adhd video 😅
@terraria99346 ай бұрын
you have single handily convinced me to try and learn rust
@holonaut6 ай бұрын
let us know how it went
@NoBoilerplate6 ай бұрын
this is the way!
@NoBoilerplate6 ай бұрын
MISSION ACCOMPLISHED! So excited for you, here's my video on how I recommend learning it: kzbin.info/www/bejne/aJm7f5dsrZ6mkNU
@funkdefied16 ай бұрын
I love this. This is the truth that I’ve learned through intuition and experience, but that I never had words for it.
@NoBoilerplate6 ай бұрын
Thank you! It's so hard to put these kinds of ideas into simple terms, if I had more time, the video would have been shorter :-D
@spr3ez6 ай бұрын
Gotta love it when you release a new banger
@NoBoilerplate6 ай бұрын
Thank you!
@greasedweasel80876 ай бұрын
Love the video! I’ve always maintained that rustc is a greater asset to the language than any individual Option or #[proc_macro] could ever be. A mild nitpick is in the comment on the slide beginning at 8:41, you have varients (e), instead of the correctly spelled variants (a)
@NoBoilerplate6 ай бұрын
Thank you, added to the errata pinned comment
@RulerOfCakes6 ай бұрын
Bravo. Yet another fantastic video on Rust! I really wish I could use the typestate pattern as elegantly in other languages as well.
@NoBoilerplate6 ай бұрын
Thank you very much! Certainly, you can still use the pattern, not as elegantly at all :(
@CollinWilliams-by5cs6 ай бұрын
Another one hit it out of the park. I would never have fallen in love with Rust if not for this channel. Please keep making videos, Tris! ❤
@NoBoilerplate6 ай бұрын
Thank you so much, that's really nice of you to say! There's not SO much left I want to say about Rust, but I'll certainly keep raving about features I love as I find them!
@hanifarroisimukhlis59896 ай бұрын
That's exactly what i do with new Rust projects: 1. Write out all the prototype code 2. Hit compile (almost always error) 3. Refactor until pass 4. Add extra feature (clap, log, config, etc) It's insanely efficient. Since i already have the model inside my head, all i need is type the code and the compiler will make sure it's semantically correct. No worry about logic error, i already thunk about edge/corner cases, validation, etc. And if any is missed, simple unit test or (in extremely complex case) fuzzing will do the rest.
@NoBoilerplate6 ай бұрын
This is my workflow too - CDD, TDD, Feature Tests, Production, Forget about it for 4 years because it's done. I LOVE writing rust code so much for this exact reason.
@wybewestra70506 ай бұрын
Ooh, can concur on the "forget about it, because it will work.". One year ago I cobbled together an rss/atom feedreader server with a web frontend. Both in rust. It has been running flawlessly on my raspberry pi ever since, and I use it every day. I wouldn't thrust code I write in python or c++ to do the same 😄.
@NoBoilerplate6 ай бұрын
I love how you can just build stuff and then move ON! (I might have done a video on this topic!)
@kamalhm-dev6 ай бұрын
That type state pattern is interesting! cant wrap my heads around implementing it in real projects though, definitely need more examples
@somefrenchguy20916 ай бұрын
I'm so happy to have a new video from you, my RSS feed needed the update
@half_invisible6 ай бұрын
Woah, you have RSS for no boilerplate uploads? How would I set that up? Thanks :)
@somefrenchguy20916 ай бұрын
@@half_invisible I have a Nextcloud instance hosted on my HomeServer and the included RSS app can just take the link to a YT channel :) I believe most RSS aggregator are able to do it
@NoBoilerplate6 ай бұрын
I use miniflux for that! RSS is truly wonderful. Aaron Schwartz left us a wonderful gift and did not deserve what happened to him 💔
@NoBoilerplate6 ай бұрын
most rss readers can subscribe to youtube channels, RSS rules!
@GreeneThumbs6 ай бұрын
I completely agree with this. I practice and advocate for type-driven development with TypeScript on my team.
@NoBoilerplate6 ай бұрын
when I must code js, I write typescript - the correct default 👌
@dylancode6 ай бұрын
Who on earth would dislike this video?! C++ and Python developers worried about their career, maybe?
@NoBoilerplate6 ай бұрын
I imagine Python - the #1 language in the world - will be around for a while! Especially if they use github.com/PyO3/pyo3
@dylancode6 ай бұрын
@@NoBoilerplate I hadn't heard of pyo3 actually, thanks for the info!
@vidal97476 ай бұрын
I really don't get the rate. Python is a good enough interpreted language. Rust is a compiled language. They are totally different things. I like both. I will not be making my plots in Rust for a single use application. I don't need to fight with the compiler for plotting some data and formatting it well. Single use scripts are much better in Python. Large projects can become an unmaintainable mess. That is why Rust is better. Stop being monogamous with your programming languages.
@dylancode6 ай бұрын
@@vidal9747 Absolutely! The comment was a joke, but Python is definitely better for throwaway scripts (and I often use it for that).
@NoBoilerplate6 ай бұрын
15-years of writing python here - it's the most popular language in the world for a REASON! There's lots of applications I would not use it for any more, but there's still plenty I *would*!
@Turalcar6 ай бұрын
10:34 First time I implemented typestate pattern was before I knew what it was called. I was generating C++ builders with a bitmask template parameter for required fields so that build() would only compile when all required fields are set. Most examples in Rust taught that this could be vastly simplified if I enforced the order of required fields.
@NoBoilerplate6 ай бұрын
Great minds!
@haraldbackfisch19816 ай бұрын
"Compiler-checked whiteboarding" - thanks ill steal that
@NoBoilerplate6 ай бұрын
yoink! Just be sure to send folks my way 😉
@haraldbackfisch19816 ай бұрын
@@NoBoilerplate but of course, also without stealing anything.. thanks for ur output :)
@NoBoilerplate6 ай бұрын
Pleasure, it's all public domain ☺️
@DavidLindesКүн бұрын
12:01 - may I suggest linking to the article in the description? I think I've found it, and without too much difficulty, but it'd have been nicer to have the link so I know I'm getting to the right thing. Thanks! And... yeah, this is definitely giving me all sorts of ideas on ways to solve certain problems (that I've been having in other languages... and now expect to find solutions to in Rust)... fun!
@codingblade26346 ай бұрын
You are just too good at talking. Love you.
@NoBoilerplate6 ай бұрын
Thank you! if you want HOURS MORE I'm half-way through season 16 of my audiofiction podcast, Lost Terminal: kzbin.info/www/bejne/pmTFdXhvoNitg8U I'd love to know what you think!
@jumbledfox20986 ай бұрын
NEW RUST VIDEO YEAH! I love rust sooo much, thanks for all the brilliant videos :3
@NoBoilerplate6 ай бұрын
Thank you! I'm a big fan too! If you can believe it :-D
@12rjig13gb6 ай бұрын
if you want the maximum help from the compiler, the coding style have to be changed too. For example, if there is a catch all arm in match enum like "_ => do_something()", then the compiler won't notify you if you add more variants to your enum later on.. So you need to be careful with those small pitfalls, same thing might happen with #[non_exhaustve] enum too
@NoBoilerplate6 ай бұрын
That's why I run clippy super strict so it keeps me honest! rust-lang.github.io/rust-clippy/master/index.html#/wildcard_enum_match_arm
@reo1016 ай бұрын
I love how close you're getting to dependent types with the typestate pattern, you're so close :D Imagine just lifting a `bool` to typelevel, instead of making the untyped On && Off structs (yes, you can make a trait to contain them, but that's kind of ugly, still working in the open set of types), just like you can with numbers (const generics mentioned)
@geeshta6 ай бұрын
The typestate pattern is exactly what I have been looking for! I have an immedieate use for it!
@geeshta6 ай бұрын
It reminds me of "Literal" types in TS or Python which I like to abuse a lot
@NoBoilerplate6 ай бұрын
extremely cool! This kind of lightweight dependent types is so handy. There's some work on it in the Rust ecosystem, and I'm excited that when they are ready, they'll be a simple macro away from integrating with my exisint code!
@fuzzy-026 ай бұрын
"So, at what time do you live? I'm alive past midnight in the clubs" "I live at compile time." "Oh? And how many did you 'compile'? Heheh" "Well, there was this beauty last night..." "And?" "Well... when I compiled I got an error not found..."
@meyou1186 ай бұрын
love the take, thx... yeh if it compiles pretty sure it works! (rust reminds me a lot of scala, without the JVM! - which is a good thing)
@NoBoilerplate6 ай бұрын
Ah Scala, my first love. Can you believe they dropped XML literals from the base install? Short sighted that is. Rust has that feature as a macro! Love that. I talk about rust vs scala in this video, btw: kzbin.info/www/bejne/rKC1c4Zmp5l4r6s
@CrIMeFiBeR6 ай бұрын
I don't like writing unit tests, because they go out of date, models change we needed to get 100% coverage for the build pipeline, so it was some stupid tests that didn't test what they needed to. But man, I love the compiler and errors in there, I am all for CDD
@Turalcar6 ай бұрын
1:50 We actually do run servers with debug symbols in production and, in case of Rust, with RUST_BACKTRACE=1 (although, I think it's been about a year since I last saw a stacktrace in production).
@NoBoilerplate6 ай бұрын
You're welcome to do what you like there, of course! There's quite a bit of granularity, not just debug/release - make sure you're getting the right mix of fast execution and debugability. I'd also prefer instrumentation (perhaps with tracing) to relying on stacktraces.
@erikastjarnstoft6 ай бұрын
Red Means Recording is great, and so are you!
@porky11186 ай бұрын
12:00 I did something similar to this for Geometric Algebra. If I multiply two versor types, the result is always a versor type. All versor types have the same implementations for all methods. In this case, both versors and non-versor multivectors have the same methods, but some have different implementations. I wasn't able to implement it in Rust, though. It requires compile time code execution and const generics. The only language which is powerful enough is probably Scopes. Maybe C++ can do, too.
@NoBoilerplate6 ай бұрын
Rust *has* first-class compile-time execution, in the macro system, here's my video on it: kzbin.info/www/bejne/g4i1gYx4pKh4l7s And though I'm not familiar with exactly what you need, rust also has const generics for 7 years: practice.course.rs/generics-traits/const-generics.html
@porky11186 ай бұрын
@@NoBoilerplate Rust macros are far from powerful enough. I could technically create a macro which generates all types for N-Dimensional GA. But then if multiple libraries use this macro, these libraries will be incompatible, since both generate their own multivector types. Besides that, I have to choose a dimension in advance. The number of multivector types for each dimension N is at least 2^N. It's technically possible, but it's not great. What's great about scopes is that there are macros, which return types and memoize their results. So if I have a multivector type as a macro (for example a quaternion MultiVector!), it would implicitly create the type definition only once at toplevel, and every usage of this macro will refer to the same type.
@NoBoilerplate6 ай бұрын
oh cool! First I heard of Scopes, very neat! The behaviour you describe (creating a type at top-level then every usage of the macro re-using the top-level type) certainly could be written as a simple rust macro.
@porky11186 ай бұрын
@@NoBoilerplate I'm pretty sure it's not possible. I would have to manually call some macro a toplevel to create the type first, and then maybe have another macro to use this type.
@itsmeagain14156 ай бұрын
I think I've seen this typestate pattern used in some of the more elegantly crafted C++ libraries I've seen! and tbh I've seen it in some places in the standard library too, but that monstrousity has nothing more going for it in this regard
@xianzhang21786 ай бұрын
Although the compiler does a lot of checks in Rust, this does not mean that unit testing is completely meaningless. We still need to test the correctness of the logic and whether the results are consistent with expectations.
@NoBoilerplate6 ай бұрын
Absolutely right. I feel like the dream workflow is: CDD, TDD, Feature tests, E2E tests - KINDOF in that order!
@iamacar10176 ай бұрын
yooo new boilerplate
@NoBoilerplate6 ай бұрын
:-D
@MrVanshajSaxena6 ай бұрын
No boilerplate
@drawtree6 ай бұрын
Consider compiler as a sort of assistant AI. Which never hallucinates, always correct, catches all of your mistakes, sometimes even suggests improvements.
@NoBoilerplate6 ай бұрын
rust and languages like it are so good to use with ai tools like copilot because of the extra context they give to the LLM, and the extra confidence they give to me in inspecting what my 1000 clueless interns have written for their group project today 😀
@Jankoekepannekoek6 ай бұрын
This isn't some novel concept, Scala devs have been doing this for ages. 'Builter pattern with phantom types' is a well-known blog post about it.
@praguevara6 ай бұрын
Really liked the light switch example, but could not find the link in the description. Perhaps you could add it?
@NoBoilerplate6 ай бұрын
I don't normally put links in the description (WAY to many! I put them in my original markdown script, linked on github). But you're right, I should make an exception for this one!
@praguevara6 ай бұрын
Haha I'm reading it right now and you're right, it's great!
@stevenbroshar79486 ай бұрын
A stop sign is similar to a fire truck. Both made of metal, for safety and red in color.
@NoBoilerplate6 ай бұрын
what do you mean?
@CielMC6 ай бұрын
I think 11:30 should be enum On {} and enum Off {} with PhantomData as it does not make sense to have “an On”
@NoBoilerplate6 ай бұрын
All the code you see in my videos is stripped out and compiled as I write it, it's all valid! you can drop the {} in this case, which is super handy.
@CielMC6 ай бұрын
@@NoBoilerplate You misunderstood, I know you can create unit structs like that, but I am proposing zero-variant enums, Unit structs still have one value, the unit. But that doesn't make sense, you can't have "an on", so the type `On` should have zero values, as in it does not exist at runtime but only as a type, so it should be `enum On {}` instead of `struct On`
@CielMC6 ай бұрын
The difference being that you cannot construct an `enum On {}`, it cannot exist as a value, unlike a unit `struct On` which has one possible value being `On`
@NoBoilerplate6 ай бұрын
oh got it! yes that's a very semantically satisfying improvement 😀
@CielMC6 ай бұрын
@@NoBoilerplate Indeed it is :D, changed my life when I found that zero variant enums can be used like this.
@Mokodokococo6 ай бұрын
About the TypeState pattern. What happens if you send a light as parameter with Light and you want to call `flip` on it. It won't know which `flip` it should call. I wish you made an entire video about this pattern. Seems great :D
@NoBoilerplate6 ай бұрын
OH I COULD HAVE MADE A WHOLE VIDEO ON IT! It's my fav pattern! I believe the answer is to use Rust's generics - this is what the trait system is for - many standard library functions can accept any kind of string (not just String or str or osstring etc) by specifying traits that parameters should adhere to, rather than concrete types.
@THEMithrandir096 ай бұрын
To me TDD was less about shipping correct code and more about designing code that's ergonomic/easy to use/test and to show that the code is able to do what the (actual) user wants it to do. Having the tests around is just a nice side-effect. Nevertheless, this looks very interesting. And great video as always :)
@NoBoilerplate6 ай бұрын
"what the actual user wants" I think you're talking about BDD tests there, larger tests that are based on user stories? TDD is quite a pure, simple theory, at its heart is just "how to code without fooling yourself!".
@THEMithrandir096 ай бұрын
@NoBoilerplate Well, user of the code or "actual" user are both very broad, and I meant it that way. User of the code is probably another dev or yourself in the future. TDD makes you write ergonomic interfaces because you'd be insane to think up a bad complicated interface for code that doesn't exist. You state what you want to do. And TDD tests can vary wildy in scope, depending on what you're working on. You might call them by different names like integration, acceptance or behaviour tests, or whatever, but at the core, you wrote a test first, made it pass and hopefully didn't forget to refactor, which counts as TDD in my book. If you enter the testcase from a function call or a call to a webapi for which you are writing a new endpoint doesn't matter, really. In fact, the latter case can be better because it's less coupled to the code you are/will be testing, which is super important to look out for.
@justinchase15346 ай бұрын
This is just OOP. This is done in every language with a type system.
@NoBoilerplate6 ай бұрын
Not quite. There are type systems and there are type systems. Certainly, you can do the basics of the typestate pattern in any language, and it's a good idea. But there are powerful parts of the ML-inspired Rust type system that lend themselves to compiler-driven development. Here's one of my videos talking about some of the magic that the Rust compiler can do, I'd love to know what you think: kzbin.info/www/bejne/rKC1c4Zmp5l4r6s
@ethanchristensen73886 ай бұрын
Have you looked into inline const assertions, and what they mean for CDD?
@NoBoilerplate6 ай бұрын
Yeah, smells similar, right? I considered expanding CDD to include compile-time TDD using const, but that's just TDD running at compile-time, there's nothing super compelling there. MODELLING your application using the type system is where the real power is!
@nergy10136 ай бұрын
As always I appreciate the new views you give on “other sides” of programming I dont usually encounter in daily work. However I seem to be missing the point where CDD is asserting actual behaviour and outcome of code, instead of testing wether or not your program compiles and handles every possible case (also a good thing, but different entirely). Im sure if you want to *test and record the behaviour of your code*, you will have to end up writing tests still… or am I missing something? Thx to anyone to answer or discuss. Cheers!
@NoBoilerplate6 ай бұрын
Quite right, CDD is the first step - quickly sketching out the core model of your code. One should RELUCTANTLY move on to TDD and so on only after exhausting CDD!
@2000krzysztof6 ай бұрын
I understand the usefulness of this but I think a mix of both would be the best practice. Using cdd is good for the general structure of the program but for things that can't really be checked at compile time like some maths calculations or off by one errors might still need tdd. But I don't know if there is a way to do it with cdd I would be impressed
@NoBoilerplate6 ай бұрын
I too think that there's a clear workflow: CDD, TDD, Functional Tests, Interactive Tests pure code -> impure code. CDD is the first step, for SURE. BTW, Rust can run arbitrary code at compile time, so you COULD if you want run unit-test-style code all ins your CDD workflow, check out my video on const: kzbin.info/www/bejne/rKC1c4Zmp5l4r6s
@pokefreak21126 ай бұрын
I'm confused about the type state pattern, since the Light just takes an unconstrained type parameter couldn't you pass in any type? How do your consumers know you're supposed to only create a Light and Light And not a Light?
@NoBoilerplate6 ай бұрын
Very good point! The example is as cut-down as I could possibly make it, so I swerved constraining the type by trait, which would solve your problem. It's not even much more code, but for a quick intro to typestate, I swerved it. Check out the Cliffle article, it's amazing!
@fabricehategekimana53506 ай бұрын
Tbh I prefer using "Type driven development". In mathematic logic, a type is the equivalent of a proposition/theorem and a member of this type is a proof. Like an image is equivalent to 1000 words, a type is equivalent to 1000 tests👌
@NoBoilerplate6 ай бұрын
love it!
@Zylak776 ай бұрын
Thank you for all your videos man! You continuously inspire me to be a better developer. Can't thank you enough!
@NoBoilerplate6 ай бұрын
my pleasure!
@liesdamnlies33726 ай бұрын
Find someone to love you like this guy loves Rust.
@NoBoilerplate6 ай бұрын
I actually love loads of other things more than Rust - but Rust allows me to FINISH my code and go and go live my life 😀
@huxleyleigh48566 ай бұрын
The typestate pattern seems similar to dependent type theory. In the programming language Idris2 that uses dependent type theory directly you can do proof driven development :)
@NoBoilerplate6 ай бұрын
Yeah! dependent types are SO cool, there are a few rust crates starting down this road. One of the features I love about Rust is because you have a macro system, you can just build in dependent types natively, and the become a first-class feature os this popular language: lib.rs/crates/deptypes
@huxleyleigh48566 ай бұрын
@@NoBoilerplate I just finished my first year of studying computer science at uni and really enjoyed the predicate logic. From there I got into Dependent Type theory through a club so it's awesome to be able to see I can incorporate simple proofs into my Rust programs. Thanks so much for the recommendation! (And for getting me into this awesome language)
@nUrnxvmhTEuU6 ай бұрын
6:05 "designed for data scientists, engineers and allists" 😂
@NoBoilerplate6 ай бұрын
Ha! I think probably the opposite is true, I sure love a table! Listening back, I think I clearly said "analysts", and my script matches that 😀
@rsaad246 ай бұрын
I wonder, how reliable this is for serious production use cases, how to figure out which pathes/cases are not safe/covered? Cuz if I cannot figure that out it means that all guarantees are void.
@NoBoilerplate6 ай бұрын
Using the type system, in any language, is 100% reliable, if it's not, it's a compiler bug. Rust's type system can encode far more information than other popular languages (such as, say, Java or Go), and so you can extend these 100% guarantees to much more of your code, leaving less requiring unit testing.
@pcache6 ай бұрын
very intriguing topic, maybe i'll try to incorporate it into my programming. in a serious production environment though, having tests, especially integration tests, is invaluable and the final sanity check between you and the client. one big advantage of traditional tests is that they are maintained separately from your developed program. in CDD, any refactoring work on the types or function signatures would leave me wondering if I haven't unwittingly created holes undetectable by the compiler's static analysis, right? i think it's a nice addition to existing good practices. leveraging the compiler to reduce the number of errors during development. but without tests i would feel my code flimsy and naked.
@NoBoilerplate6 ай бұрын
Oh of course, I agree. CDD is the first step, but once you've got the pure model of the code correct, developing runtime features using TDD, then putting into place feature tests and so on is of course essential.
@Blaineworld6 ай бұрын
this is kind of something i figured out on my own. in a text adventure io library i still haven’t finished, i had a Pen struct that handles printing text, which can be turned into a Prompt struct that handles reading commands and then turning that part of the text into just a summary of the command. i had not thought to use a generic parameter for this and i will look into that. maybe.
@NoBoilerplate6 ай бұрын
Games are FULL of state machines that would be amazing modelled using the typestate pattern - read the cliffle article I linked to to see all of it's power!
@foresthobo11666 ай бұрын
What is mean by "model" in this video? It seems to have some additional meaning I'm not familiar with.
@NoBoilerplate6 ай бұрын
With an advanced type system, you can use types not just to store some values, but express relationships between types, including behaviours that would otherwise have to be enforced in your run-time program (think of rust's enums: they *model* a requirement that they must be in exactly one state at a time) You can model your application on a whiteboard, or in UML or in dedicated prototyping tools, but in Rust, you can model a LOT of logic inside the type system!
@nullPointer0x02 ай бұрын
"Conversation between you and the compiler". In my case it's not a conservation because the other party (the compiler) is yelling. 😀
@vidstige6 ай бұрын
"If it compiles, it works". Great quote! This has been my feeling as well, and it's awesome. the The light switch example in the end though... Not so convincing? What good does that really do? Maybe it was just a poor example?
@NoBoilerplate6 ай бұрын
Quite possibly, It's the absolute smallest example I could show. Maybe I should have gone with the classic traffic light? DO read the linked cliffle article, it's so powerful!
@eventh19876 ай бұрын
I love the idea of the TypeState pattern. I love compile-time checks and guarantees in general. Faster feedback and everything else. But I have some hesitance about using it, after having tried using it. I've been working a pretty large personal rust project (a game-adjacent app) for a while, and it had a lot of these kinds of invariants that on the surface I would have loved to encode in types. The problem is, as far as I've seen working on my project on and off for the past 4 years, that at some point you need _so_ many generics and types that not only do you run out of names for everything, more importantly, your code just ends up an unwieldy mess of deeply nested types. I ended up having to refactor my code to just check a lot of invariants on start up rather than have everything in the type system. What do you (or anyone reading this) think about how TypeState scales up with bigger projects? Genuinely curious what people's experiences are using this "in the wild". BTW long time lurker. Love your videos. The videos are just so stylish and every time I get exposed to new ideas or less talked about ideas that makes me re-evaluate how I code. Keep up the great work!
@NoBoilerplate6 ай бұрын
Thank you so much, that's very kind of you to say! Naming, program organisation, namespaces - Rust has the same design challenges as any other language, it's the hardest part, honestly! Come ask that question on my discord - there's genius overe there!
@eventh19876 ай бұрын
@@NoBoilerplate I just might. And you're very much welcome :>
@carterplasek4986 ай бұрын
Is there any significance to the roundabout in London the coordinates point to?
@NoBoilerplate6 ай бұрын
WELL SPOTTED! Trafalgar Square is often given as the centre of London, I suppose I pulled those from the london wiki page!
@ErikBongers6 ай бұрын
I like the Lights example: it's code that doesn't produce any runtime. All structs are empty. Indeed, empty structs may help you to create semantic-only types that have no runtime effect, and only serve to guide the compiler. I guess I do "compiler driven refactoring" when I'm writing some code where I think 'Hey...if I were to call that function now...things would crash. How can I protect myself from that?" I will then refactor so the compiler no longer allows me to do this or that. I guess this is the opposite of good old win32 functions where the documentations says: "This parameter is reserved. If you pass anything other than NULL, the function call will fail."
@NoBoilerplate6 ай бұрын
Oh, the cliffle article I linked to has a few options for storing other information in the state - I just kept it very tiny for my example. Do read it!
@NetherFX6 ай бұрын
Seeing 11:10, you might be interested in learning about the PhantomData marked in the std. If you only use the state for defining functions and you never read this value, making it a zero-sized type is an option (Maybe you're planning on making a billion lights, who knows!).
@NoBoilerplate6 ай бұрын
Quite right! PhantomData is mentioned in the linked Cliffle post - I stripped out as much as I could - traits, boxed state data, phantomdata etc - to make my demo as small as possible.
@NetherFX6 ай бұрын
@@NoBoilerplate That's fair, a very informative video as always (:
@JohnnySacc6 ай бұрын
At work I very seldom actually run the services I'm writing locally. Just as you say: I write, I run clippy, then I push and let CI take care of the rest.
@NoBoilerplate6 ай бұрын
The dream! CDD first, then TDD, and finally some functional tests for production!
@johanngambolputty53516 ай бұрын
TDD kinda reminds me of generative adversarial NN's, where you have a generator and a discriminator each having the goal of catching out the other, self adversarial programing if you will.
@NoBoilerplate6 ай бұрын
interesting!
@AntonKryu6 ай бұрын
I actually use this in typescript. Types there also can be quite powerful if you know how to use them
@NoBoilerplate6 ай бұрын
Big fan of typescript, when I work in a js framework, this is what I use!
@Mawkler6 ай бұрын
Awesome that your videos are public domain now as well! Have you considered posting them to PeerTube and/or Odysee as well?
@NoBoilerplate6 ай бұрын
Odysee is a non-starter for me, as is anything blockchain. PeerTube is a real possibility - activitypub is a great option, and I've been delighted with Mastodon! (Please excuse me, I must point out that everyone on my patreon and ko-fi can watch ad-free and without (google's) tracking.)
@anon_y_mousse6 ай бұрын
Maybe I just need a better example to help me visualize generically how this could be applied because that link which talks about HTTP requests seems convoluted and full of too much boilerplate, which kind of seems like a natural negative consequence of how Rust implements enums. For instance, if I were implementing a mechanism to handle requests, I'd put everything in that one class, and there would be no need to return different structs or whatever. This also kind of strikes me as one of the quirky flaws of method chaining because then you have to return different types to allow the chain to continue. Of course, since we're talking about HTTP requests, I'd probably just fill in default details and have functions to let the user replace the defaults or not if they shouldn't care. Certain things would obviously be an error, like a lack of target IP and so on, but there are things which the user might not want to care about, or shouldn't have to manually handle. For instance, one of the things about the example that strikes me as wrong is the status codes being passed as magic numbers/strings instead of having a set of enumerated names so the user doesn't need to know the actual status code, such as just STATUS_OK instead of passing (200, "OK"). And on top of that the content length being set by the user passing anything at all. That's one of those things that would never be explicit in such a library were I writing it because the user could pass the wrong value and that's a huge flaw, where instead the library should calculate it for you and set it automatically. The two examples he gives of where such things go wrong in C++ I agree with, but they're also kind of irrelevant. Sure, move semantics should probably be implemented better and more at the compiler level, but things like closing files really is better with RAII and it's just a matter of slightly modifying those classes. Of course, I don't agree that Rust actually makes these things easier or ergonomic as that code looks disgusting and makes me want to barf worse than reading STL code in C++.
@ericng88076 ай бұрын
It's been too long since you uploaded a Rust video! Ended up using Go
@NoBoilerplate6 ай бұрын
That sounds like a "you" problem ;-) I really like Go too! If Rust didn't exist, I'd be happily using it. Many similar good decisions over there. And, of course, quite a few ones I don't agree with.
@pandrr2355Ай бұрын
How do you create your slides?
@NoBoilerplate27 күн бұрын
obsidian :-) kzbin.info/www/bejne/epPWcoSJfrCEjs0
@exotic-gem6 ай бұрын
I’ve been skeptical of Rust for a while, as a C developer first and foremost, but I think I might try it. I fear it will demand I surrender more control than I am comfortable doing, but I hope it will optimize the code in ways any C compiler simply cannot.
@NoBoilerplate6 ай бұрын
Don't believe what people say, try it out for yourself. Here's how I recommend getting started: kzbin.info/www/bejne/aJm7f5dsrZ6mkNU
@justsomeonepassingby38386 ай бұрын
What you describe in this video is almost exactly how i wrote code in rust. Except, i would have to run through my entire codebase every time i changed my data types however, i stopped using rust after realizing that making the rust compiler into a Lisp library is the only way to apply the unix philosophy to compilers and to extend the language organically. In the (very) long term, i think lisp will still outlast rust and import its features.
@NoBoilerplate6 ай бұрын
I love lisp, I have described Rust as "lisp and haskell in C's clothing" in previous videos. I agree, lisp will outlast Rust. However, this begs the question "What *IS* lisp"? - Is it lambda calculus? if so commonlisp is not lisp, it's got loads of junk like classes and non-functional stuff in, a concession to practicality. - Is lisp s-expressions? McCarthy would ask what about m-expression, then. - Is lisp a language with Graham's 9 lisp features: Conditionals, first-class functions, recursion, no compiler types, GC, expressions, symbols, tree-based syntax, the language always available? Then Rust is as much a lisp as clojure, it has 8/9 of those features! (and "no compiler types" doesn't sound like a feature I value) It's very easy for an *idea* to live forever. Perhaps one day lisp will conquer the world. It'll need better type handling than typed clojure if I am to use it, if that is the case :-)
@justsomeonepassingby38386 ай бұрын
@@NoBoilerplate TL;DR: i deviated from lisp towards what uses i have for lisp which rust cannot fit. I go back to rust vs lisp at the end Thanks for replying. I love your videos. I recently went back from rust fanatism to lisp elitism, but i am not a lisp guru (i usually use python, i tried to switch to rust everywhere but running a rust IDE and compiler in a virtual machine is too expensive. I might try again after i fix my VM obsession, if the rust compiler adds better support for shared library compilation of dependencies to reduce linking time) I have watched your previous videos, and at that time i almost accepted the idea that rust was "as powerful as lisp, just much harder to meta-program". However, the metaprogramming part of lisp is almost skipped over by rust. It almost looks like the rust developpers knew everything from haskell to c++ and assembly, but only knew lisp marginally. Maybe this is due to lisp being the radical opposite of static languages like haskell. To me, the most important features lisp still has over every other languages are: -an axiomatic (self-mutating) language where everything is defined in itself (this makes it a language that "scales with abstractions" and gives the user a new point of view where the language is something mutable instead of a set of constraints like haskell) -a language that maximize user power/expressivity, over safety, correctness and even performance (this allows some classes of algorithms that would be completely impossible in stricter languages, such as mutating cons cells to implement efficient queues) The latter is completely opposite with what makes a language scalable in a project with lots of developpers (lisp is more suited to small teams), and actually makes it harder to prove that a program works as intended (instead, tests are done through interactive debugging until things "seem to work") To be fair, the reason why i care more about "abstractive scalability" and interactive debugging even over developper efficiency, code correctness and performance, is because i am gambling on AI becoming as good as humans at programming. To prepare for this scenario, i want to make lisp into the universal language for everything written by AI. In summary, i want: -a haxe-like cross-programming language (lisp can do this easily with its simple, data-oriented syntax) -a language that does not become obsolete in the next decades, regardless of the type of project (this is where the "abstractive scalability" comes into play) -a simple core that could be written/understood by an AI (currently reduced down to 50 lines of python to describe evaluation rules) -interactive debugging, since this would allow AI to use a bottom-up, exploratory approach instead of writing 200 lines of code that is incorrect in a single prompt -the runtime does not matter. The final executables (including its own interpreter) are cross-programmed With all that said, no of my requirements are related to my own programming. I do not have a complete mastery over lisp (even though i am trying), and i dare not claim that lisp is the best language for actual programmers (since i know how powerful static languages can be). I am still going to favor lisp over rust, because i think lisp has the potential to stay my entire career and fit every use case i encounter. To conclude with some "downsides" i could The only real complaints i have about rust are: -having to always be aware of low level details (this is not a bad thing, but this combined with the compilation time of static dependencies make rust uncompetitive for "quick and dirty" projects) -having all the complexity of the rust compiler in a single place goes against the unix minimalist philosophy (this makes the language almost impossible to understand and contribute to, but that's a tradeoff all static languages accept in exchange for more powerful control over the code -using a text-based representation for syntax (something any serious language does, but i think we can move past that someday, and lisp seems closer to that as it can be viewed as a raw AST, edited structurally in emacs, and encoded as any data format like json or lists) There are also major downsides to lisp (like the obsolescence of the ansi common lisp standard, the unuseability of scheme, the fragmentation of the implementation strategies for macros or continuations,...) But currently, guile and picolisp seem to fit for my taste for my quest of the perfect language. I hope reading this won't take you as much time as it took me to write
@NoBoilerplate6 ай бұрын
Let me help you with compile times first before getting back to lisp. Something's set up wrongly on your vm: rust is not slow to compile. here are some things to try: - compile *twice* and forget how long the first compile took. first compile times get amortized to zero, and rust's incrimental compilation makes most subsequent compiles near instant. - Think of this as an initial `npm install` or `pip install` or `gem install` etc - first time slow, subsequent times fast - sccache - Sccache provides a global cross-project deps cache, you should always be using it (the arch linux wiki has a great page on it) - I can't help your slow ides. I used doom emacs great with rust, and I currently use neovim with lazynvim, both are faster than any ide. RIGHT. Regarding the rest of your comment, - lack of metaprogramming - lack of a small core - having to always be aware of low level details - the blub paradox I'm pleased to say that your assumptions here simply aren't true. We're here because Rust does all these well! - the whole language is indeed always available, in rust's macro system (please watch my video on this here kzbin.info/www/bejne/g4i1gYx4pKh4l7s and let me know what you think!) - Rust is programmed in rust, using macros system. While a tiny part of it is bootstrapped in machine code (just like any lisp) the rest is written in Rust (kzbin.info/www/bejne/rGe1qX2poJ2iqrs) - You DON'T have to always be aware of low-level details. Rust's genius (but confusingly-named) `unsafe` system allows us to build safe abstractions on inherently unsafe real-world hardware. I was a web developer for 15 years, 2 of those writing clojure professionally. I don't care about low-level details. If rust didn't provide best-in-class abstractions (lisp-style macros) I would not care about Rust and I'd probably be using picolisp too 😀
@justsomeonepassingby38386 ай бұрын
@@NoBoilerplate Thanks for replying, but please let us spare ourselves some time T_T about my problems with rust, i think my last comment wasn't clear enough. By compilation time, i actually meant linking time (by default, everything is linked statically, so using multiple large libraries like rocket and surrealdb means the linker has to do a lot of work each time). Static analysis means i don't have to compile often, though. I have tried to solve this problem with dynamic linking. This works great, but only for a single large dependency, because shared dependencies between large libraries must not be duplicated. Theoretically, this problem is easy to solve (by linking to the same crate dynamically from multiple places), except the libraries themselves have to add a setting to their cargo file to allow dynamic linking with their dependencies (and most don't). So the cargo developpers have to make this setting implicit before all dependencies can be made dynamic. My other performance problem is that since i do everything in virtual machine, adding 10GB of compiled libraries to my rust VM is expensive (i can't just reclaim the space by deleting it, i have to "defragment" my VM or make a new one). My (jetbrains at first, then vim) rust setup was fine at first, but doing it a few times and failing to setup vim correctly (after doing it repeatedly before) made me go back to python. Now the ideological (useless) part, and a bit more about why lisp is lisp: Overall, rust is still a great language for the elite. I still love it, i just don't use it because i am a VM freak with too many specific requirements. I don't even care that much about lisp except for the interactive development experience, which i can usually reproduce in python About metaprogramming in rust: rust's syntax is complex. Have you ever written your own rust macros ? I didn't (and i never had the need for it, to be fair). From what i theoretically know (since i haven't written one), rust macros like vec! can only accept a finite number of parameters. Rust written as a raw AST and with parenthesis could be a lisp too, but then it would require more I didn't know rust itself was bootstrapped with macros, but i guess it makes sense. This is interesting, thanks for mentioning it. The other part where i wasn't clear enough is that my "having to always be aware of low level details", i also didn't actually mean low level details. I was referring to memory management. I got far enough in rust that i could write a parser combinator library with closures, and i could manage reference lifetimes without much trouble, but some types of algorithms are just impossible because they cannot be defined with statically correct algorithms. I know rust has GC features like refcount, i just haven't been able to spend enough time with rust to master them. Please don't try to justify how rust is a great language, i already know. Rust is how i learnt advanced memory management techniques when i came from python (though i did learn assembly, lisp, ocaml and compilers before joining the cult), and made me a better developper. There is another thing lisp (and many other dynamic languages) do that rust cannot do: some abstractions (like dynamic typing, garbage collection, or continuations) can be made efficient to the point where it becomes a net plus. Garbage collection, for example, can be made incremental or even real-time. For applications that do not need this feature, stop-the-world GCs can be even faster than manual memory management (though the memory waste feels bad). For the user, the language is just simpler: memory is easier to manage, and some algorithms that were not even possible by tracking memory manually can now be implemented without leaking memory. In lisp, these abstractions (conditions/tail call optimization, optional type annotations and garbage collected cons cells) are the main way to program at all. And i think this is why macros are the obvious solution to everything in lisp (lisp macros don't just rely on lists and macros, they also massively rely on variadic functions, lexical closures AND dynamic binding, and just plain recursion) I think it's the set of these features (with more or less equivalent features in other lisps, like call/cc in scheme to implement a high level, safe goto) that makes lisp a lisp. And the fact that rust misses these features might be the reason why rust users do not rely so much on metaprogramming It's not that metaprogramming is a requirement. Rust is a great language as it is. To go back to lisp vs rust: Rust is a language that starts by being perfect. The best way to learn rust is to accept that idea until it makes sense. I think your videos do a great job of showing that. The usual answer to doubt is "keep calm and trust the compiler". Maybe this will end like C++, with a big refactor into a new language decades later, i don't know. Lisp is a language that tries its best to give you unlimited power, and allows the user to get the job done, even if the job is to write C. Lisp makes no promise about the future, except being easy to bootstrap and not having to care about following standards when configuring my Nyxt browser. Both languages are great (except rust is perfect and lisp makes everything possible) i will still prefer lisp because it fits my style of solo development more than rust. Thanks for replying. I never doubted the perfection of rust in the first place, i just want to use guix and guile right now because that's what motivates me currently. I'll probably go back to rust at some point, and i still keep rust in my resume
@NoBoilerplate6 ай бұрын
My apologies, I think I understand where you're coming from a lot more now, thank you for taking the time. Yes, the linking time was brutal - did you see that super recently the linker was switched? 40% reduction in linking times as of: blog.rust-lang.org/2024/05/17/enabling-rust-lld-on-linux.html But that was just the low-hanging fruit, plenty of optimisations still to make, and I look forward to them. Until then, we seem to be going about things very differently - I run on the fastest bare-metal machine I can, whereas you're running on VMs, with the inherent challenges and advantages there. Have you heard of my new god, nixos, by chance? 😉 best of both worlds there - I can isolate what I want, and get bare-metal speed for everything. "Have you ever written your own rust macro" is a very amusing question for me. I was asked that EXACT question after I presented this talk (kzbin.info/www/bejne/oZCXo3-vpraYd6M) at ClojureX 2017 - but this was about writing macros in lisp! I think macros are inherently strange, no matter the syntax. My answer then is my answer now: "You may not write macros day-to-day, but your code is cleaner and more elegant for having them in your language." I would be raving about Haskell if it were only a bit more popular. It supports lisp syntax btw 😉
@sososo39063 ай бұрын
If the burden of writing tests is replaced with the burden of writing types, i think it's an improvement, but i don't know why
@l0gic236 ай бұрын
Quadratic seems awesome. Take that "Smartsheet", et.! Quadratic, are you accessible? Ensure your product is fully Accessable - you ad your CFO can thank me later
@RustyNova6 ай бұрын
Welp. Thank you for making me want to yet again refactor my code to use typestate patterns. I got this awful struct with an optional field that is wanted to be Some() 75% of the time, and I keep having to deal with checking/propagating None. This definitely would help enforce it
@NoBoilerplate6 ай бұрын
You know what you have to do 😀
@techpriest47876 ай бұрын
So. First CDD then TDD for what is left.
@NoBoilerplate6 ай бұрын
You've got it!
@PeidosFTW6 ай бұрын
0:44 Some more news reference?
@Alex-cx7tv6 ай бұрын
Depending on if I’m writing the code for school/personal use that will never see a server/robot I’ll use CDD all day everyday. If I’m getting paid for it, I’ll spend an hour writing a largely if a is true then test pass type test because it’s a requirement in the work place. I.e self evident tests
@NoBoilerplate6 ай бұрын
There's nothing worse than writing bullshit code, even if you're getting paid for it. You deserve more, annoy your colleagues with perfectly modelled code at work, too 😀
@papakamirneron25146 ай бұрын
Something I don't understand is why not use a language such as mojo which lets you keep a comfortably pythonic syntax?
@NoBoilerplate6 ай бұрын
Because popularity counts. I didn't talk about Rust before 2022 not because I didn't know about it, but because all new language have infinite potential when no-one's using them. Rust matters because it's in the top 20: redmonk.com/sogrady/2024/03/08/language-rankings-1-24/
@papakamirneron25146 ай бұрын
@@NoBoilerplate I agree that popularity counts but in the specific case of mojo (and perhaps tons more) you do have compactibility with every python libary so it doesnt matter much, its like typescript: an optional superset that doesn't break anything.
@jolkert6 ай бұрын
i know this is an unpopular opinion, but my answer is because i *really* hate python's syntax
@NoBoilerplate6 ай бұрын
I've now reminded myself what mojo is. "python but native speed" isn't a feature for me. My whole career has been in python. 15 years. And I'm sick of it. Python's core compromise of a GC, coupled with the GIL, whitespace syntax, are no longer things I value. In short, the above core features make easy things easier, but hard things harder. I am no longer impressed by how small a hello world is, or how few characters I have to type to do simple things. Here's my video on why Rust is not a faster horse kzbin.info/www/bejne/aoq4kKVtZd56oLM
@jolkert6 ай бұрын
@@NoBoilerplate tbh whitespace syntax is one of the biggest "it doesn't technically matter all that much but I hate it anyways" feature of basically any programming language. any language with it loses a lot of points in my mind
@jackcrump-leys54576 ай бұрын
I have a feeling that this guy is a fan of rust.
@NoBoilerplate6 ай бұрын
Garbage game for garbage people
@jackcrump-leys54576 ай бұрын
@@NoBoilerplate game? I mean the programming language.
@zerker20006 ай бұрын
"The rust compiler is faster than a REPL" XD XD
@NoBoilerplate6 ай бұрын
To be clear, I said, "The compiler is faster than all these methods, but to be fair, and balanced, it's because it's doing less." I've written production lisp at a bank, I LOVE repl-driven development, but compiler-driven is SO much faster!
@anon_y_mousse6 ай бұрын
@@NoBoilerplate I'm not sure why you'd believe that given how slow Rust compiles, even when working incrementally. Every REPL that I know of can use the full width and breadth of the language, even down to importing modules, and thus iteration is nearly instantaneous because it's a simple matter of :w from the other window and the up arrow key followed by enter to rerun the import line again.
@nightshade4276 ай бұрын
running the rust compiler takes same amount of time as running test suite for other platforms with time to get a snack 🤣
@laundmo6 ай бұрын
i mean, the first time sure. but the build caching is pretty damn good. so unless you build in release mode while testing - dont - its pretty fast the second, third, etc. time you compile some iterative changes.
@NoBoilerplate6 ай бұрын
Don't repeat stuff you've heard other people say - give it a try! Wouldn't it be amazing if what I'm saying was true? 😉 kzbin.info/www/bejne/aJm7f5dsrZ6mkNU