« first day (2052 days earlier)      last day (1430 days later) » 

12:24 AM
this is frustrating. I don't like feeling like I can't trust the compiler. I spent a few hours on it, haven't learned much
 
 
2 hours later…
2:27 AM
@DenysSéguret well, how can I do it so ?
I have +7000+ of code that borrow for my parser
I want a task that do the parse send result to another task, etc
I really don't know how to do it
I put what as lifetime 'static ?
 
 
2 hours later…
4:41 AM
@DenysSéguret best crate docs.rs/rental/0.5.4/rental/index.html
This save me
 
 
1 hour later…
6:01 AM
well, async will be the limit of this safe api
didn't find other crate that handle self referenciel struct that require async initialization
 
 
1 hour later…
7:30 AM
clearly never in Rust
 
 
5 hours later…
12:53 PM
> I found an example that was using async/await which so far I've only ever seen in Javascript/Node.js code. I don't know why anyone would intentionally introduce that concept into Rust, it's a wart on top of promises.
 
1:11 PM
SO or red arrow site ?
 
1:25 PM
@DenysSéguret SO
It's surprising to me
because I just fixed some pre async code to be async
and it's much better
@trentcl much thanks <3
 
1:55 PM
:)
 
Can anyone remember the name of the crate that gives you metadata about the crate you are in? e.g. the crate name and source directory?
I have seen it mentioned recently but it's a bugger to search for
oh wait, no... that's not it
Can the crate name from std::module_path!, but not the rest
 
2:15 PM
@PeterHall I don't know. Whatcha trying to do?
 
I want to print the crate name and version
 
This is easier, I do it in broot in the help screen
Is that what you want ?
 
is CARGO_PKG_VERSION set for each binary?
I mean, doesn't that depend on how you run it
 
no, it's inserted at compilation
 
oh, I didn't realise
ok that works better :)
 
2:24 PM
That's one of those things which make you love Rust even more
 
@DenysSéguret Is such a thing even possible?!?!!?!
 
nobody's watching us ? Can we confess our immature fan love ?
 
/me points at the room tags in the corner
 
2:39 PM
@DenysSéguret You are free to confess your immense love for GATs.
 
2:50 PM
So, is it a general rule of thumb to just slap in a backtrace to all leaf error variants?
 
@E_4_net_or_whatever_it_is if you like backtraces, then yeah.
 
@Shepmaster I do like the idea of having more than Error(PrematureEOF) in my errors, sure.
 
SNAFU encourages delegating the backtrace method to the leaf from non-leaf
so you can just call backtrace on the outer-most
there's also the possibility of walking the causal chain
@E_4_net_or_whatever_it_is my main argument against it is to have enough error types / variants that you don't need a backtrace
I effectively advocate for a semantic backtrace based on the errors
 
Well, I intend to pick this up in the near future. I've yet to understand what might be best for the project.
 
Hi everyone! The 2020 Dev Survey results are out and Rust is the most loved language again. I edit the the Stack Overflow blog, and I'd like to run an article about why our community likes Rust. Reach out to me here or at pitches@stackoverflow.com -- I'd love to feature our community on the blog for this
7
 
3:04 PM
LOL... just read a few comments up
 
Howdy @RyanDonovan!
(I worked with Ryan for my SO blog post)
 
Hi Jake! That post still gets lots of love :)
@DenysSéguret Do you want to organize it into something quotable? I'd be happy to include a link to your site or whatever
 
I do agree that no single comment can explain the general enthusiasm with Rust. It's a combination of many factors IMO.
 
3:19 PM
@RyanDonovan This specific message was quite anecdotal. But we frequently have such enthusiasm when we discover that a quite powerful feature like reading a compilation context element under the disguise of an env variable can be done so elegantly, and even be solved at compile time, without any ugly unconsistency.
(and I'm not a young coder discovering his first language, I started programming almost 40 years ago and learnt a lot of them)
 
@E_4_net_or_whatever_it_is If you're willing to email me your thoughts on what those factors are, I'd be happy to quote you. I've got well more space than a comment to play with. :)
 
@DenysSéguret Certainly sounds like you are on your way to writing something :-)
 
@DenysSéguret That's a pretty lovely summation. Can I quote you?
 
@RyanDonovan of course you can
@Shepmaster Unsure. I deleted my blog a few years ago.
 
@DenysSéguret doesn't have to go into your blog...
 
3:26 PM
It's possible there might be some value in a text in which the old bearded coder I am would summarize and deepens a few thoughts about Rust but I'm not sure I'll find time for that. Just a few minutes ago my home boss (my 4yo son) asked very vehemently for a dragon in the Lapin game (a FOSS Rust game, for those who don't know it). And I promised a new version of broot this week...
 
^ Gracious. :)
 
@DenysSéguret TBH, talking about the intersection of Lapin, you, and your kids would be pretty wonderful, IMO
but I get the free time issue ;-)
 
Yeah, I know you have a young kid yourself and I'm sure you care about him so you know how precious time is
@Shepmaster I wrote a small thing in dev.to about Lapin: dev.to/dystroy/lapin-a-terminal-game-in-rust-6np
I think I'll try a "pair programming" session with my 6yo to introduce the dragon and, depending on how it works out, I might write about the experience (to be clear, the goal isn't to teach programming to my 6yo but to ensure he has less wrong ideas about the topic).
 
@DenysSéguret you know, I did read this...
 
It's a little too on the surface side of things, though
 
3:40 PM
I had forgotten about it though
 
@RyanDonovan Another possible quote (or idea that you might deepen yourself without quoting me) from my dev.to post:
> An exemple of the zero cost abstractions and the sanity it brings is the use of separate types for the position on screen and the position in the game's world, I know I usually have confusion in code dealing with several reference systems in the same unit and there was none this time.
 
4:11 PM
 
4:25 PM
@DenysSéguret Oh you met @Shepmaster in person?
 
 
3 hours later…
6:56 PM
@RyanDonovan I think there are three main reasons why people fell in love with Rust so easily.
The first one is that it found a sweetspot: it is just as low-level as C or C++ with all the advantages of these (e.g. control, size, speed, etc.) but at the same time it is as high-level as Haskell with an amazing amount of functional heritage, but it is still imperative so quite accessible to most people, and it is just as flexible as Python but concepts like "duck-typing" are happening at compile time (i.e. trait bounds),
yet it does not have the dated, object-orinted programming model and all of its well known problems. The second reason, I believe, is the momentum that the community has: people write more feature rich, faster, easier to maintain, and more robust and solid tools every day to replace or extend the existing utilities we use on a daily basis.
And last but not least, in my opinion, the batteries which are included: the small and concise syntax, the small number of features the language provides, the integrity of the standard library as well as its consistency and the quality of its documentation, including the learning materials for both beginners and advanced users are all contributing factors.
 
7:12 PM
@Shepmaster BTW snafu is much used in my work :p
 
@Stargateur stop making such failure prone software ;-)
<3
 
@DenysSéguret I always say don't take my word specially promise as true, because I often don't do what I say I should do :p
 
Well, I try to do what I said I'll do
@Shepmaster I don't handle errors because my code is bug free. Is that OK ?
 
> Well, if you like shooting yourself in the foot, then just dont buy a gun ;) C++ is perfectly safe as long as you know what you are doing. Rust is written in c++, and you trust rust, which uses c++, so c++ is perfectly safe. Even if later it will be rewritten in itself, like java, at its core it is still c++.
not bad not bad...
 
@DenysSéguret A thing I like about Rust is that it really yells at you if you don't handle them somehow.
 
7:20 PM
@Shepmaster I even think not handling results should be considered an error. Today it's just a warning
@Stargateur this is just plain stupidity
 
@DenysSéguret I think that this person assume rust was in C++ cause you need C++ runtime in window... (and linux ? don't know)
 
@DenysSéguret #[deny] isn't that hard to add to your crate ;-)
 
@Shepmaster yes but people who decide to add this aren't really the ones who are at risk of disregarding an error
 
@DenysSéguret :truth:
 
@Shepmaster I use clap that use obsolete feature that generate user side error...
 
7:25 PM
@Stargateur from macros?
 
clap has some design problems which impact safety IMO
 
and why pollen exist ? why ? the last days have been a nightmare and today, my nose starting to mutate to stone
@Shepmaster yes
@DenysSéguret I didn't find better but I feel it too
 
@Stargateur I've used the sexy one, argh, but I found out it's too limited, by hard design. Clap is a little ugly and unsafe but at least it's flexible
 
what is unsafe ?!?
 
using strings as keys, for example
I got bitten by this one
You can query a launch argument that you didn't declare and there's no compile time check of that
 
7:30 PM
but clap is block at v2 from sometime... I way they release the v3
@DenysSéguret oh yeah. but there is limit to compile check...
I didn't find a crate that have the feature I wanted and flexibility
at first I used structopt but run into limitation very fast
but it's ok tier for me because it's only command parse 1. I will probably not do much better myself 2. only problem could be wrong parsing my program will fallback to default case so totally ok. 3. only 2 person use my program....
 
@Stargateur I mean the solution is to not use strings as keys. Generating from macros is a possibility
 
Oh yeah... that remind me I must do it for my database handle....
there is so many thing that mongodb rust driver miss
 
7:57 PM
@PeterVaro Thanks Peter! This is fantastic. Do you have a title and/or link you want to include in the post?
 
@RyanDonovan A title for what? A link pointing where? :thinking:
 
@PeterVaro Your title to go with your quote, like "Lead programmer" or something, and a link to your personal site or workplace
 
@RyanDonovan Ah, right, okay :) Sure, 'Senior Software Engineer' is fine, and my personal site is petervaro.com
(both of those are on my SO profile ;))
 
'Not Very old & hairy man that write code"
 
@Stargateur Thanks, that sums it up.. Am I that old though? :thinking:
 
8:07 PM
@PeterVaro fixed
 
@Stargateur huh?
 
change "very" to "not very"
 
haha, kk
 
@Stargateur I am the "very old and hairy man who writes code"
 
I'm the "Soon old"
 
8:13 PM
IMO as long as you are willing to change you are not old. Being old is not a matter of years you lived.
 
should I wait 18 minutes to check spaceX doesn't go challenger or should I go to sleep?
 
well, for me it's just physical description
 
@PeterVaro wait till your body starts falling apart. Being willing is only part of the problem.
 
@DenysSéguret watch while trying to sleep so if you really want to know you will stay awake if not you will sleep
 
broot is ready for a new release. I worked months for this one. It's strange to have that check list empty. I'll probably release tomorrow or, if I have too much work, the day after
 
8:18 PM
@DenysSéguret ah, that is partially happening already -- I meant the mental part. If you're still willing to change your routine, your habits, willing to learn new things still, happy to be outside of your comfort-zone -- then you're not old at all. In case you can't do these when you're 20, you're already too old for this life :P
 
@DenysSéguret Launch scrubbed for weather 'til Sat
 
@PeterVaro Well, I spend half the day learning new things (and my day is long as I start working at 6AM). But the body does age.
 
@DenysSéguret is '/' drama fixed so ?
 
@DenysSéguret agreed.. hence the quote on my profile:
> A pity youth is wasted on the young. — George Bernard Shaw
 
@Zarenor thanks. Sleep it is, then
@Stargateur What was this one ?
oh
 
8:21 PM
@Zarenor Thanks for that heads-up
 
that wasn't really a problem, it just meant some ugly code on my side when I prefer to use std one (for path normalization)
 
// FIXME LATER
 
no, it's fixed... there's even test units and a bench entry... but it's ugly and I don't like to have code which should be standard in my app
I'd rather not have this ugly thing...
let ends_with_slash = path.as_ref().to_str().map_or(false, |s| s.ends_with('/'));
(and here only because I'll add back the / at the end of operation...)
 
you could use a trait to reduce the verbosity
if you use this line a lot
 
no, only once
or I would have written my alternative to Path
 
8:29 PM
well I wonder this:
fn size(mut n: u64) -> u64 {
    let mut i = 1;
    while n / 10 != 0 {
        n /= 10;
        i += 1;
    }
    i
}
but I can't think it in std xd
I don't know how this is call
the max power radix of a number ?
 
isn't that the log?
 
@Shepmaster log ?
logarythm ?
maybe I'm don't know much of advanced math
but you make sense
but log only is for floating
yes it's log
num doesn't implement log on integer
 
@trentcl Sure thing. Wife and I were watching the stream, disappointed when they called it. Unless something goes horribly wrong defueling, nothing exciting happening. Concerns were downrange lightning, I think?
 
@Shepmaster when I said this crate look good docs.rs/radixal/0.3.0/radixal/…
the iter impl fused
all the code is clean
 
8:47 PM
pfft, fused iterators
what a nerd
 
well, fused iterator are legion but think to remember to impl fusediter to allow optimisation on 0.1% of code is nice :p
and... cargo going crazy cargo check is ok but cargo build fail without reason
cargo clean take like ... 15 s on a nvme XD
 
9:48 PM
 
9:59 PM
argh, std::io::Error doesn't implement Clone :(
 
@FrancisGagné yeah because backtrace
 
@Stargateur also because custom errors
 
> E: Into<Box<dyn Error + Send + Sync>>
 
yeah that, I can't clone a Box<dyn Error + Send + Sync>
I guess I was trying to be too clever trying to load this tiny file only one instead of twice
 
I don't understand why they do that
 
10:04 PM
I'll just load the file twice, the performance impact will be negligible
 
@FrancisGagné ?
why you copy error so ?
 
the result of loading and parsing the file was stored in a lazy static global, with type io::Result<Vec<Record>>
the idea was to propagate the error every time the global is accessed
but that would require cloning the error
 
wow put the result of a parsed file into a global Oo
global fail your program can't work
maybe better to just unwrap
or do a custom error
 
10:23 PM
@Stargateur well that's why I was preserving the error in the global, so that it wouldn't panic immediately, but then again this file is required for the program to do its job, so the error will be propagated immediately anyway
the program's purpose is to migrate data from Btrieve database tables to a SQL Server database; it's a batch process
 
just unwrap in the lazy static really...
if one day your program will work without you will think about it ^^
KISS
 
11:10 PM
dam code review take too much time
 

« first day (2052 days earlier)      last day (1430 days later) »