« first day (1770 days earlier)      last day (1717 days later) » 

8:04 AM
@E_net4 I hope that async will become a first class citizen in Rust, tho.
There should be a "use abstraction" over sync/async to easily select the needed item to use.
 
8:26 AM
Async isn't always needed, but indeed, the ecosystem should not hinder the decision to use it.
 
@E_net4 I know, but for example, for any IO operation, there should be a choice, e.g. use std::fs::read_to_string or use std::fs::async::read_to_string
(Not sure if async is a "real" keyword)
 
@FrenchBoiethios At best, this choice may involve a Cargo feature or a separate crate, so it's only included when necessary.
@FrenchBoiethios It will be. I'm not sure if it can be used as a module name.
 
@E_net4 That was my interrogation: some keyword are (can be) only situational
 
@FrenchBoiethios The only thing I know right now is that both async and await are reserved keywords.
But eh, it seems you can't. Nightly said so.
 
And the horrible r#async isn't an option :P
Everything should be async by default, so that the modules will be named sync
 
8:38 AM
 
@hellow haw haw
@FrenchBoiethios Uh, noep?
 
@hellow Here is the real fix (when the joke goes too far)
 
@FrenchBoiethios you screwed it up... original implementation returned 5 :(
 
This is too much. This is a regression.
 
jokes are for education :)
so I got that going for me
 
8:45 AM
@hellow Noooooo :'(
 
It's like migrating C++14 code back to C++99.
 
@E_net4 Eh, who really wants to do IO operations synchronously?
 
@FrenchBoiethios I'm afraid you're underestimating the amount of use cases which really don't need async I/O.
 
@E_net4 In my day-to-day job, I write web servers, so I may be biased :P
 
I never understood the use case of async nor really used them :X
 
8:55 AM
@hellow That basically speeds up your application when you do a lot of IO operations
Because the threads don't wait for your operations to finish
 
I finally found the tweet I was looking for. twitter.com/pcwalton/status/1161035311226294272?s=20
@FrenchBoiethios ^
@hellow ^^
It can indeed make better use of your computational resources, but it's not meant to be the de facto way of doing I/O.
e.g. I don't claim my tool heel-gun to be an ideal use case for async I/O. I used it because I wanted to gain some experience with futures.
 
@E_net4 Interesting. In C# (that's what I do everyday), you must write everything async to be usable
 
@hellow That's an old trick from when there was very little memory. Don't do that, now :P
 
 
2 hours later…
10:58 AM
@FrenchBoiethios I hope not
@FrenchBoiethios fucking no
 
@Stargateur I haven't decided yet how I feel about it. I lean towards your opinion though.
 
Jen
Today I truly realised the pain of not being able to handle OOM.
 
@E_net4 really? how? why?
what could've you done about it?
 
Relevant Q
@PeterVaro Not easy, it would likely involve making forks of collection structures. The community wants to address this with RFC 2116.
Something as simple as a file indicating the size of an upcoming structure can abort the entire program.
 
11:38 AM
@E_net4 Well, that was my first disappointment in Rust
 
12:13 PM
@E_net4 Writing a try_reserve before every allocating call would be tedious :/
I don't like text_io. Why using a macro when a function can do the job?
 
@FrenchBoiethios functions can't have arbitrary number of arguments
 
@hellow Ah, you're right, that's because of that: docs.rs/text_io/0.1.7/text_io/#advanced
But that can be done with another function...
read_with_pattern for example
 
@FrenchBoiethios It doesn't have to be for every call.
Often we know one allocation which is particularly problematic (e.g. the size depends on user input).
 
@E_net4 That's even worse, because you have to verify the needed space each time you want to do an operation that can allocate
 
@FrenchBoiethios We can't do that.
 
12:21 PM
@E_net4 Hmm, right, I understand
 
I mean, I'm facing a concrete use case for try_reserve right now, in the nifti crate.
 
@FrenchBoiethios that what I do in C
I don't see the problem
every function should return a possible error
almost
 
@E_net4 Of course, you can. For example, before a push, if len == capacity then try_reserve; then push
 
@FrenchBoiethios That would be testing whether the allocation is possible, not whether you have the needed space. Yes, it's a bit of pedantry, but it's worth emphasizing the different levels of operation.
 
@Stargateur I've no issue with that, but if there is a try_reserve, there should be a try_push, a try_insert, etc.
 
12:24 PM
yep
 
With a try_reserve, all other methods are trivially obtainable. Having them as public methods in the main API would not be mandatory.
 
I prefer do try_push
then try reserve
 
o_O
try_push implies try_reserve, right?
 
that where we see that I'm the coder and you the science
 
:|
@Stargateur I don't know how to reply to that. Care to expand?
 
12:32 PM
@E_net4 He probably refers to practical vs theoretical differences? (real life vs academic usage perhaps) But I'd also like to hear what he thought of..
 
@PeterVaro That point sounds too much like an ad hominem to me.
An unfounded one too.
 
12:57 PM
Hmm, did I just spot Shep?
 
1:08 PM
@E_net4 not at all
that just two different way of doing things
 
How would you try_push without something of the likes of try_reserve within?
 
both
we must have both
 
But why?
 
do you really want do:
if my_vec.capacity() == my_vec.len() {
    try_reserve(1)?;
}
my_vec.push() ?
every time you want push one item ?
it's better to have a try_push that enforce the reserve failure
that to just only have try_reserve
you loose nothing have both and you win something
 
Actually, I'd prefer the behavior to be the same as Vec::reserve on that regard.
If the vector already has enough capacity, it does not need to allocate.
The equivalent of try_push is actually try_reserve(1) followed by a push.
 
1:16 PM
not it's not
you will always reverse one aditional space even if vec is not full
also this will need twice verification of len
instead of one
could be opti by compiler
 
@Stargateur That's not what the docs say.
@Stargateur I'm relying on that, sure.
 
@E_net4 o/
 
@Shepmaster \o
En garde!
 
@E_net4 oh you rigth
I would still prefer have both :p
 
And that may well be considered.
 
1:44 PM
@PeterHall we are rep-whores.. instead of using the dup-hammer, we thought we could earn some easy reps, didn't we? ;)
 
2:18 PM
@PeterVaro I deleted mine when I saw you answered first - mine didn't add anything
 
@PeterHall I saw that, it's very noble of you, I appreciate it!
 
The dupe might not be a dupe exactly. OP just doesn't know how traits work or what the as operator does
 
2:37 PM
Has anyone ever replaced the derived Debug impl on a struct to one which overrides the formatter options? E.g. to always print integer fields in hex
 
You mean create your own derive macro that does that, or just implement Debug manually?
 
I mean implementing Debug manually on a specific struct where its fields are more readable in a specific format (such as in hexadecimal).
So that format!("{:?}", MyType(16)) would yield "MyType(0x10)"
 
Ok, so you're having difficulty with that?
 
I'm not having difficulty implementing it.
I'm trying to understand whether this is idiomatic.
 
@E_net4 yes
 
2:42 PM
On the one hand, it's indeed useful: dbg! and assert_*! macros will provide more readable messages.
@Shepmaster Tell me more!
:)
 
@E_net4 Probably not. Usually you'd use a format string, like "{:X?}"
that format will be applied to fields of a struct too
 
Am I understanding the question correctly?
 
@Shepmaster Yeah, I suppose so. Perhaps this will close the thought gap?
 
For my case (hashing), printing out numbers never makes sense as it's all bits.
In your case, it looks like the normal FourCC type of code?
 
@Shepmaster In that situation, I would create a newtype instead of using raw integers, and add a custom Debug impl just for that newtype
 
2:46 PM
@PeterHall Yep, that's where I was heading :-)
 
@Shepmaster Not quite. It's for DICOM tags
 
@E_net4 i mean, it's 4 bytes, yeah
> Other file formats that make important use of the four-byte ID concept are the Standard MIDI File (SMF) format, the PNG image file format, the 3DS (3D Studio Max) mesh file format and the ICC profile format.
 
Display provides a readable form, but this one isn't used in Debug at the moment.
Yeah, sort of.
 
@E_net4 I think it's most idiomatic to create a Dicom newtype and implement Display/Debug for that.
 
Anyway, I agree that it's not "just" an integer but it's a Tag
 
2:49 PM
@PeterHall Tag already is a type for describing a tag.
It doesn't make sense to wrap it around a newtype.
 
Tag is a primitive in your domain, and it makes sense to implement custom Debug / Display for such primitives.
 
Goodies.
 
The Display impl should probably produce (0123, FEDC), and Debug produce (0x0123, 0xFEDC).
Or probably Dicom(0x0123, 0xFEDC), if that's the type
 
It's a tag, so I'll stick to Tag(...)
 
oh, exactly what your code does already :)
 
3:00 PM
but the question was mostly around "should Tag remove the ability of the user to format it in a particular way", yeah?
If you wanted to be fancy, you could probably pass on the formatting flags if it's hex-related
 
or check if formatting rules have been applied, and honour them if they have
if formatter.debug_lower_hex() { .. } else {....
oh.. except there is no way to un-hex a number
decimal is the default so you can't specify that
and... debug_lower_hex() is not a public method on Formatter...
 
isn't this the same ol' self referencing dup? stackoverflow.com/questions/57559393
(I just don't know the canonical dup for this)
 
3:20 PM
@Shepmaster cheers matey! I asked for MCVE 'cause I might be wrong about the self-referencing thing, I only briefly looked at it..
 
@PeterHall So no, I would be preventing the consumer from choosing a format for the tag components. But putting things in perspective, I can't see how this would be a problem.
Streaming iterator? Do I hear GATs?
 
4:14 PM
@E_net4 you hear what you want to hear
 
Ey, at least this looks like good news.
 
@E_net4 so what are you doing with all your free time, Doctor?
 
@Shepmaster I'm not sure of what you speak of.
I am a very busy viro.
But to those who may concern, I'm pushing dicom-rs further towards its 1st release, among other things.
 
@E_net4 "viro"?
 
@Shepmaster Mi estas viro.
 
4:22 PM
Oh, Esperanto, not PT
> I turn this around.
Could have made sense
 
@Shepmaster That would've been "homem".
 
I'm just going by google translate here
which detects "viro" as Finnish for "Estonia"
Which was quite odd
 
Mkay, gotta run now.
 
 
1 hour later…
 
1 hour later…
7:15 PM
@Shepmaster Oh, I only got that now. xD "viro" is indeed Portuguese for the 1st person present form of the verb "virar" -> to turn or flip.
 
7:34 PM
@E_net4 What's your most frequent spoken language?
 
@Shepmaster Portuguese.
For work, currently at the lab we only have native speakers, so we still use it for general conversation. For giving talks to the group and whatnot, we often prefer English. Writing is usually English all the way.
 
@E_net4 So Esperanto is all @E_net4 ?
 
@Shepmaster Jes.
 
 
1 hour later…
9:09 PM
All righty, back to Rust.
 
 
2 hours later…
11:01 PM
European folk, did you see this?
 

« first day (1770 days earlier)      last day (1717 days later) »