« first day (2063 days earlier)      last day (1409 days later) » 

12:48 AM
I have an parsed = {toml::value::Value} of which I don't know the identifier of. It's built from line = {&str}" description = \"string\"". I'm trying to get "description" in that example, but the methods I see in the docs mostly seem to interact with the value \"string\". How can I get the unkown index of such a value?
 
 
1 hour later…
1:59 AM
@FélixGagnon-Grenier From where I'm standing (haven't used the crate myself) it looks like a Value is just the "string" part and you need to ask the Table it's stored in for the key (description).
Table is a type alias for BTreeMap<String, Value> so presumably you can use that somehow.
 
uh huh, that seems to be getting further towards it, thanks for the hint
 
 
7 hours later…
8:45 AM
@trentcl There is no such thing as forward compatibility. In fact, there should not be one because the future should be an open road. Who cares if a certain thing is going to be possible in the future? It may or may not happen anyway, there's no certainty about that! I hate this acronym for many reasons, but in this case it has a point: YAGNI.
 
 
4 hours later…
12:20 PM
@FélixGagnon-Grenier unclear what you ask
@PeterVaro Rust community is too afraid of breaking change
 
@PeterVaro So you don't mind if virtually every std release contains a breaking change? We'd be on Rust 36.something under that scheme.
 
@trentcl Couldn't care less -- that's why we have this thing called versions! ;) There's a breaking change in the new version? No worries, I stick with the old one then. But there's a new and shiny feature I need so much in the new version? Well, I'll port my code to the new version then.
And that is beside the point: if something is not certain that is going to happen -- then don't worry about it today. It is a very simple, yet powerful mindset.
> Each day shall have their own problems
(That's a hungarian saying, I'm sure there's a similar one in english as well)
 
give them to the you of tomorrow
 
(After a bit of digging around, I'm a bit disappointed that this saying is not a traditional hungarian one, it is just a paraphrase of a specific verse of the book of Matthew.. Oh well..)
 
@PeterVaro I was going to say... sounds familiar
 
12:31 PM
@trentcl :sweat_smile:
 
Anyway, I disagree. Forward compatibility is a nice feature, and a lot of companies wouldn't even look at Rust if there weren't some kind of stability guarantee going forward. Look at how much of a stink there was (still is) about Python 3.
 
That is an unfair comparison! The 2 to 3 migration of Python is I believe one of the greatest fuck ups that has ever happened with language versions. That has nothing to do with the tools, the version schema, the language itself, etc. Miscommunication, internal and community level disagreement, grace-period extensions (at least 3 times), etc.
It is what people like to call a clusterfuck.
But if you look at the versions of C (which I believe is a much better comparison) it could be done properly. The problem with C versions is the speed of adoption.
(But then again, it is also not a very good comparison, because C has standards, while Rust only has implementation.)
Moreover, breaking changes could not be avoided, this is the nature of how software works and the nature of progress: we (as in, human beings) did not invent a better way to progress than trial and fail. More fails than trials to be precise.
 
@PeterVaro The only backwards-incompatible change in C standards I'm aware of is the removal of gets, and that took 22 years.
Oh, and the removal of mandatory VLAs! That only took 12 years.
 
@trentcl IIRC VLAs were introduced in C99, and were marked as optional as early as C11, no?
Or was it C18?
either way, less than 12 years :P :P :P
 
12:47 PM
@trentcl remove of VLA C11
anyway I don't understand what you say by forward compatibility
it's doesn't make sense to me
so we never do breaking change ?
we will end up like windows still implementing DOS thing in 2020
 
@PeterVaro I'm not sure why it's an unfair comparison. I'm not comparing the release cadence or anything like that. I'm just saying, look at the community reaction to Python saying "Hey, we're going to bump the major version number" and imagine if Rust did that every release.
not sure who is not agreeing with 2011 - 1999 = 12
 
I think peter was more speaking about crates.
Rust itself need some stability
 
std is a crate
 
@trentcl :face_palm: I can't do basic math today.. sorry!
 
it happens to the best of us :)
 
12:50 PM
@trentcl std is not a normal crate
 
@trentcl 1. Not every release should have breaking changes 2. I'm still not talking about in general, but reserving things without having clear roadmaps or justification about their certainty. That is just madness.
 
@PeterVaro I understand your argument and respectfully disagree ^_^
 
@trentcl Ah, okay then. Thanks for the debate in this case ;)
 
1:21 PM
 
 
2 hours later…
3:18 PM
'ey folks. Any opinions on logging façades? log or slog?
 
3:29 PM
Probably depends on what you do. Is it a small application or a big entreprisy frameworky construct that must smell like legacy and prove new interns that you're serious ?
(no, I'm not biased)
 
I use log
there is some overhead but we are in 2020
if we can't log some line....
 
3:44 PM
I don't see any case where this overhead would matter
(compared to the throughput or size of where you log)
And even when I log dozens of line during a benchmark, I see no impact.
 
It's for a growing project, with several crates. And I will need to pick one.
But this is interesting, there is an adaptor. docs.rs/slog-stdlog/4.0.0/slog_stdlog
It might not be that much of a risk to depend on log after all.
 
4:06 PM
@DenysSéguret the overhead is when you don't log anything
sayd you put info! but user turn off the log
you still pay for it
 
4:44 PM
@Stargateur You mean in the case where the user disables logging at run-time? AFAIK you can turn logging into no-ops at compile time.
 
@E_net4isdownhausted ?
magic ?
if you can config something in runtime
you can't have zero cost if disable
 
@Stargateur That's what I meant.
Although I imagine the overhead to be negligible in that case.
Something that logging facades in other languages also pay regardless (e.g. slf4j).
But if you have a tool that never intends to support logging, you should be able to make it zero-overhead by giving it a no-op logging impl.
 
that what I said...
it's not zero cost if disable
 
We're on the same page.
 
but as I said in my opinion in 2020 we can afford a if in a code :p
 
4:49 PM
Aye
 
 
4 hours later…
8:48 PM
I was trying to write a macro, and things were going fine, until I tried to implement operator overloading. I'm trying to setup a macro so that I can define a 3D and 4D vector with less code duplication. This is a shortened version that shows the problem:
```macro_rules! impl_vector {
( $VectorN:ident { $( $field:ident ),+ } ) => {

impl <S: Scalar> Add for $VectorN<S> {
type Output = Self;

fn add(self, v: Self) -> Self {
// mismatched types
// expected type parameter `S`, found associated type
Why does code formatting not work the same way in chat? >:/
macro_rules! impl_vector {
    ( $VectorN:ident { $( $field:ident ),+ } ) => {

        impl <S: Scalar> Add for $VectorN<S> {
            type Output = Self;

            fn add(self, v: Self) -> Self {
                // mismatched types
                // expected type parameter `S`, found associated type
                // note: expected type parameter `S`
                // found associated type `<S as std::ops::Add>::Output`
                // note: you might be missing a type parameter or trait bound rustc(E0308)
There it is... finally :/
Sorry for the spammy thing. Always ran into the formatting differences here :v
 
9:33 PM
28
Q: How do I require a generic type implement an operation like Add, Sub, Mul, or Div in a generic function?

Maxim SloykoI'm trying to implement a generic function in Rust where the only requirement for the argument is that the multiplication operation should be defined. I'm trying to implement a generic "power", but will go with a simpler cube function to illustrate the problem: use std::ops::Mul; fn cube<T: Mul>...

 

« first day (2063 days earlier)      last day (1409 days later) »