« first day (1962 days earlier)      last day (1517 days later) » 

12:38 AM
OK, the syntax highlighting colors changed, right?
 
12:55 AM
@Shepmaster yes indeed
 
1:21 AM
Has anybody used rust for robotics/embedded? Can we use rust with raspberry pi?
 
@Unbreachable yes; yes.
 
Alright cool. Do you practice with it daily? Or do more of system programming?
 
practice Rust daily? more or less, yeah.
 
Specifically the robotics/embedded part.
I really want to get into using rust for that field like raspberry pi to create robots and stuff. Any recommendations, please?
 
Oh, I don't really. I mean I have an Pi; Arduino; and Discovery board, but it's not my main thing.
 
1:31 AM
Oh I see, well what do you think of rust with the raspberry pi? Your thoughts?
 
1:51 AM
Seems reasonable enough. The devices aren't super powerful, so it feels like you can get a lot of benefit from some efficient code
 
2:01 AM
Alrighty thanks
 
... so I get an no function or associated item named new` found for struct nhl::Player in the current scope`. However, I do think it's there:
#[juniper::object]
impl Player {
    pub fn new(name: String) -> Player {
        Player {
            name,
            stats: HashMap::new(),
        }
    }
}
However when calling it using the Player{name, stats: HashMap::new()}; it is correctly visible
 
And if you remove #[juniper::object]?
 
how about making two impl blocks, one with new and one with that attribute
 
2:17 AM
it does work! that's... interesting :)
... I have no idea why that would behave like that. Juniper would "override" the new fn?
 
proc macros can do whatever they want
> // A **warning**: only GraphQL fields can be specified in this impl block.
> // If you want to define normal methods on the struct,
> // you have to do so in a separate, normal `impl` block.
Now, I don't think that important warning should be IN A COMMENT IN A CODE BLOCK
So I think you could submit a PR to improve the visibility of that
 
hmmm, it does mention "This macro lets you define GraphQL object fields in a Rust impl block for a type."
Which could be a hint that it must be only graphql object fields...
 
 
5 hours later…
7:26 AM
@Stargateur I could have picked a binary format but JSON is easy for everybody to hack with any language or just an editor
(I tried also ron but the default formatting made huge files)
 
8:01 AM
 
or messagepack, which is more compatible
but I prefer to have a hackable text format
and TBH I didn't care much, it's just a few lines to change in the program
(I juste serde and when your (de)ser is compatible with json it's compatible with about everything I guess)
 
I didn't look at the rmp library but I know messagepack, it's trivial
 
well, that said go to work
 
 
3 hours later…
10:37 AM
The rustc message you get when you forget const in a declaration is a little off
(there's no ! in the whole file)
 
10:58 AM
@DenysSéguret wait to try async
I have some error message that don't make anysense
 
 
3 hours later…
1:30 PM
0
Q: as_deref function doesn't change my concrete type

StargateurI would like to convert my Option<&String> to Option<&str> with as_deref() but the compiler seem to ignore it. Replace it with .map(|e| e.as_str()) work. use std::collections::HashMap; trait SipField { fn from(&self) -> Option<&str>; } impl SipField for HashMap<String, Vec<String>> { ...

I think it's because my type is &String
 
1:43 PM
Yes, this would work for String but I don't see any reason for it to work for &String (and I don't see any shortcut but that doesn't mean there's none)
 
I don't have one too ^^
 
2:12 PM
@Shepmaster I just added a new contact in my messenger of choice (Telegram) and said person uses Kirby as their avatar. Now everytime my eyes land on that avatar my brain is startled and thinks "Why is there a Shepmaster in my Telegram?!?". So yes, you successfully conditioned my brain, congratulations :P
 
2:39 PM
@LukasKalbertodt the real question is why isn’t there a Shepmaster in there
Or: are you sure we aren’t the same person?
 
@Shepmaster Well, I guess I have already plenty of ways to communicate with the real Shepmaster. If he prefers Telegram though, he may speak up :D
@Shepmaster Pretty sure ;-) Too many differences.
 
3:00 PM
posted on February 27, 2020 by The Rust Release Team

The Rust team has published a new point release of Rust, 1.41.1. Rust is a programming language that is empowering everyone to build reliable and efficient software. If you have a previous version of Rust installed via rustup, getting Rust 1.41.1 is as easy as: rustup update stable If you don't have it already, you can get rustup from the appropriate page on our website. What's in 1.41.1 st

 
/me runs rustup update without reading
 
 
1 hour later…
4:14 PM
> Rust 1.41.1 addresses two critical regressions introduced in Rust 1.41.0: a soundness hole related to static lifetimes, and a miscompilation causing segfaults. These regressions do not affect earlier releases of Rust, and we recommend users of Rust 1.41.0 to upgrade as soon as possible. Another issue related to interactions between 'static and Copy implementations, dating back to Rust 1.0, was also addressed by this release.
 
@DenysSéguret yes you should omg
 
Would you still use as to convert between integer types? I've always hated that, and now we have From/TryFrom for everything
There is no way this isn't a dupe
 
Hello, guys. Should I learn Rust or Go? I think Rust is more desirable because you can build WebAssembly with it...
 
4:40 PM
you can build webassembly with go too
It's reasonable to think this room might be a little biased in favor of rust
What's your use case ?
 
@DenysSéguret I'm just a learner and want to see which one is better. But I thought Rust was better that's why I'm here. Can you give me the link that shows webassembly development with Golang?
thanx
 
no I can't
and I don't think it's a good idea
 
@bravemaster Go is easier to get started with, but in the long run you probably get annoyed by several things in the language. That's how I felt. "minimalism" as highest rule of language design is not a great idea IMO. Rust has a larger up-front learning cost (although not as high you might think), but it just keeps giving ;-)
Also, I think Rust is certainly the best language for WASM.
 
The problem of go with webassembly is that your wasm file must include the garbage collector and the rest of the runtime
 
But remember what @DenysSéguret said: we are all probably biased towards Rust :D
 
4:50 PM
I know both Go and Rust and I really don't see any reason to code in Go anymore apart to support legacy
For some people, the ease of Go is a clear advantage
 
@DenysSéguret Why can't you show me the link? Is it because you don't know or you want to prevent people from going from rust to go? Or is it a copyright problem? :)
Ironically, I found Rust more easy to start with. Go was a little hard for me to understand. :D
 
I'm not google. I don't know by heart all the links to all resources. I know you can build wasm in go and toyed with it but I can't find you things better than google
If you find rust easy, go for it
 
@DenysSéguret Thanks. I searched WebAssembly and they only told me build it with Rust. So I thought, Go is not in their repository.
 
If webassembly is the only goal, Go is clearly not the most suitable language
 
 
2 hours later…
7:51 PM
@Shepmaster fun fact, it seems to be even more pervasive. That #[juniper::object] macro seems to completely strip the methods from the type, preventing for instance a test that would use said method.
18 |         assert_eq!(31, stats.points());
   |                              ^^^^^^ method not found in `SeasonStats`
case in point (hah) that method exists in the macro'd impl block, is used by the graphql schema but throws :/
 
@FélixGagnon-Grenier You could use cargo expand to see what it actually generates
I wonder if it moves it to a trait or renames it or something
 
I am not aware of this, let me check :)
 
8:12 PM
@Shepmaster I think it is a trait
impl juniper::GraphQLType<juniper::DefaultScalarValue> for SeasonStats
all custom methods in the object macro block are converted to cases in a match in a resolveField method
    match field {
        "points" => {}
        "shootingPercentage" => {}
        "goals" => {}
        "assists" => {}
        "shotsOnGoal" => {}
        "hits" => {}
        _ => {}
    }
so... yeah. no trace of the methods on the final type impl
in any event, I guess I'll... not test those entities directly.
 
8:36 PM
@FélixGagnon-Grenier are they actually empty match arms?
 
nah, I shortened it
 
Are the arms your method bodies?
 
I'm still parsing what exactly they do:
        "points" => {
            let res = {
                (|| -> i32 {
                    {
                        self.goals + self.assists
                    }
                })()
            };
            juniper::IntoResolvable::into(res, executor.context()).and_then(|res| match res {
                Some((ctx, r)) => executor.replaced_context(ctx).resolve_with_ctx(&(), &r),
                None => Ok(juniper::Value::null()),
            })
        }
the first part seems like a pattern of instantly calling anonymous functions I,ve seen in other languages
after that, it seems like juniper doing its thing to make that into a coherent graphql thing
 
IIFE
 
8:39 PM
Here So you can use ?
 
pardon?
@Shepmaster no
the IIFE's bodies seem to be so far
 
They use IIFEs so you can use ? in your methods.
If you wanted to be clever/confusing, you could implement the method in your normal impl block, then call the method of the same name in the graphql impl block
 
Which is what I’d argue the procmacro should have done effectively
 
ah, the joy of discovering new messages when trying funky stuff expected &String, found &UncasedStr``
... and I'm quite unsure what this means, but I'll have to postpone that, now is time to go actually play hockey. thanks for the help!
 

« first day (1962 days earlier)      last day (1517 days later) »