« first day (1869 days earlier)      last day (1610 days later) » 

12:35 AM
64
Q: What is a "fat pointer" in Rust?

Lukas KalbertodtI've read the term "fat pointer" in several contexts already, but I'm not sure what exactly it means and when it is used in Rust. The pointer seems to be twice as large as a normal pointer, but I don't understand why. It also seems to have something to do with trait objects.

 
@loganfsmyth thanks?
 
@набиячлэвэли Perhaps you can make a struct which has a dyn member and pass a pointer to that instead of the pointer to dyn Write? Then the thing you're passing doesn't have to hold the vtable pointer along with the data pointer, so it would be a normal pointer
I'm not familiar enough to say whether there's a specific common approach to this type of thing
 
well, I can't really allocate because I'm not notified of last use/destruction
oooor I could make the caller deal with it and pass me a &WriteWrapper(&mut dyn Write), good point
@loganfsmyth bless
 
1:13 AM
@набиячлэвэли I honestly think you do something dodgy if you have to pass fat-pointers to your wrapped/interfaced library, especially when it comes to dyn. I'm not sure of your specific use case nor the actual requirements but in general I would introduce an intermediate layer in my system design to support the specialisation of the Rust-specific, implementation defined types and the lower-level C types. In fact, I would design this from the bottom-up, that is, create some low-level type
that C understands perfectly and it is easy to work with. Then design a Rust representation that can be translated into this external representation -- aka the intermediate layer. Then design and deal with the ultra-high level stuff Rust can give you, which needs to be translated into the intermediate representation.
 
This kind of design (if it is possible and applicable in your case) would give you enough flexibility and modularity in the long run that you could support easily in a well-defined way both your fancy high-level and low-level bindings
 
which is called via
pub fn init_write<'out>(self, out: &'out mut WriteWrapper<'out>) -> Result<FlacEncoder<'out>, FlacEncoderInitError> {
    let result = unsafe {
        FLAC__stream_encoder_init_stream((self.0).0,
                                         Some(flac_encoder_write_write_callback),
                                         None, None, None,
                                         out as *mut WriteWrapper as *mut c_void)
    };
    self.do_init(result)
}
I'm pretty sure this is the intermediate layer
 
I'm almost certain it is not :)
But OTOH I have to go to sleep now. I'm happy to get back to you later, or read back and reply to your comments if you leave some.
ta ta
~
 
indeed, may the utmost crab bless you in your sleep
3
 
 
3 hours later…
4:40 AM
0
Q: How Explicit Return Statement, forbid implicit Return in rust

Yannfn calc() -> u32 { return 1+1; } Forbid fn calc() -> u32 { 1+1 } has any setting in cargo.toml? sure the code style is same

haha
 
 
4 hours later…
8:32 AM
@Shepmaster Well, at the moment, I'm using a full-Rust static site generator, that would be cool if I don't use any Node stuff
If you don't want an expression-oriented language, you should forbid this kind of statement: let i = if condition { 0 } else { 1 }; and use let i; if condition { i = 0; } else { i = 1; }. Same for the match. — French Boiethios 9 secs ago
@Stargateur ^
 
@FrenchBoiethios When building sites, we usually have a lot of things to do, not just sass to css transformation, but also things among minification, lint, transpilation, packing, i18n, image optimization, etc. (and in my case many specific additions) What do you plan to use for that ?
I'm not sure everybody understands this "explicit return" question the same way.
explicit return in closures will be cool too...
 
9:20 AM
@DenysSéguret I want to build my kinda "resume" site, that's not a full-featured commercial app
And I don't use any JS
@DenysSéguret You mean return from outer scope?
That cannot happen. What if you store the closure into a variable and you call it from another scope?
 
no, just return. if you do ...iter().all(|a| a.is_thing()) or ...iter().all(A::is_thing) and you want to have only explicit return as asked by that question
I was only answering your comment, not asking for a Rust feature
 
Anyway, this question is dumb...
 
yes it is
 
10:03 AM
Do you know which timezone URLO uses for the posts ? I've opened with and without proxy(different timezone) but the time informations were just the same.
 
@ÖmerErden I've looked at the HTML: there are data-time attributes holding timestamps (ms since Epoch UTC), which seems to mean the displayed date is computed by your browser for your local time. The proxy would change nothing
That's also what I do for Miaou, this is IMO the best way (in normal cases) to ensure the date is displayed at best according to the user's settings: only send to the browser UTC timestamps
 
@DenysSéguret Aah thanks, interesting SO is not doing it like that
i mean the showing date relatively
 
10:19 AM
test
kindof
The timestamp is sent with the message in the websocket message
 
Chat is fine, i meant the posts
 
oh, sorry
 
it uses ISO format +0, i don't know if there is any specific reason.
 
oh my... I just looked at a SO QA in dev tools... it's so ugly... and looks so inefficient...
This really looks like something which was done in the PHP era and was never rewritten, only given additions (and probably with a lot of hardware thrown at it)
 
<span title="2019-11-26 07:02:19Z" class="relativetime">3 hours ago</span>
it is even named as relativetime : P
Ok it is 3 hours ago for everyone but the title is not relative
 
10:37 AM
@DenysSéguret you're not far off
but then again, so is the fate of most companies that scale too fast
it's okay though, Sara Chipps is about to save them a lot of hardware costs ;-)
 
@DenysSéguret quite literally everything on SO is old AF and unmaintained
that's why I keep complaining about things -- is really rewarding twice as much rep for the upvote on questions the most burning issue we have? unlikely.
and in some ways this is so embarrassing, isn't it? The site devs use the most on the internet is in one of the shittiest state..
/RANT-OFF
 
11:04 AM
@PeterVaro this is when you need to ask yourself the real question: who the target demographic is
 
11:14 AM
@SébastienRenauld what d'you mean?
 
Are you, the persona wanting a smooth, optimized website, the target for the focus of the team
 
I still don't get what you are saying. Yes, I think the design of SO (and its implementation) is outdated, the notification system is slow and broken, the chat interface never actually worked as it supposed to (not to mention a proper integration with the main site), the jobs view and capabilities is just lacking.. everything at the moment is just 'meh' at best -- yet, because of the community, the content provided (as in, answers) still make it worth revisiting.
How hard could it be to make it actually usable?
I truly don't understand the lack of features introduced to this site for the last 7-8 years
 
My point is that it's just not a priority and they can attract the people they want to attract without
their target audience is joe random having a question
they'll post the question, get their answer and fuck off to greater pastures
 
Right, in that case, why is the community not holding their answers back?
 
11:28 AM
same. I stopped answering the day I saw the reputation change
 
the goodwill bank is empty
Just in case you're not in the loop: stackoverflow.blog/2019/11/25/…
 
I read this post last night
 
I didn't. SO blog posts are long wall of texts written in a foreign looking language
 
@DenysSéguret essentially, they're moving to close meta.SE
or make it so pointless people won't bother
feedback will now be private, survey-based, and the survey asks for your race, age and gender
three things that would be highly illegal in France BTW
 
I answered "none" to the race question
 
11:31 AM
@DenysSéguret the feedback process isn't public
Sara could very well go "Well, I don't care about non-white non-women" and discard all the rest and nobody would know
 
I mean there was a survey. I completed it, only to find it about empty. And there was a race question
 
@SaraChipps Why does the survey not ask about our religious affiliation? Surely if there's one aspect of people's identity that is likely to cause them to be discriminated, it is religion? Does SE not care about under-represented religious minorities? How could you have missed this opportunity to put us into an additional box? — m69 ''snarky and unwelcoming'' 9 hours ago
That's actually a really good point
way more relevant than the race is the religion, particularly due to christianity.SE, judaism.SE etc
 
but... it's about programming, not about our "identities"
 
The point this comment shows is that it's about some identities
SE only cares about certain dimensions
 
don't give them hints about other dimensions
 
11:39 AM
They have plenty but chose to ignore them because it doesn't fit their message
They obviously don't care about religious people because that clearly clashes with the "toxic racist mysoginist community" message they're trying to shove
 
@SébastienRenauld why am I not surprised those SE sites exist?
 
12:06 PM
> I learn RUST ad GO at home (coming from 20 years JAVA professional experience).
All those years and they never learned that Java isn't an acronym.
 
@trentcl Man, that's one of my bugbears
@trentcl lol, I just saw the title: "pretending"
At least they are honest
 
where is that from ?
 
-4
Q: Learning a new language => when can i pretend to have reached intermediate level?

bernard dradeouI learn RUST ad GO at home (coming from 20 years JAVA professional experience). What should i do to come at an interview and pretend i'm ready for professional develoment ?

 
That's not even a real question: nobody wants you to know Rust at interviews. sob.
 
No need to pile on the DVs, it's already closed
I mentioned Rust in an interview and think it cost me, even
 
12:24 PM
Anyone else think that voting volume has increased in recent history?
 
You mean on SO questions and answers ? No idea
 
At specifically
In the last 12h, theres
-5, 4, 3, -5
I feel like 1.5 votes was usual
 
I only look at questions and answers when they're linked here. And I didn't vote in the last 12 hours. Zero is less than my average. So if I extrapolate my case to the general one I think voting decreased. I don't have anything more helpful to add.
 
12:37 PM
Hmm, yeah, it does seem unusual
I assume the negative ones have been in the review queue, which... "helps" a little
 
52k and still not able to look for familiar looking collection strucs
 
1:40 PM
@SébastienRenauld I don't even know how to react.. I'm just deeply sad, that's all.
 
 
2 hours later…
3:15 PM
-4
Q: How can I require explicit return statements and forbid implicit returns?

YannI want to ensure the code style is consistent by requiring this: fn calc() -> u32 { return 1 + 1; } And forbidding this: fn calc() -> u32 { 1 + 1 } Is there any setting in Cargo.toml?

wow so much down vote
I TOTALLY disagree with so much down vote
the question is perfectly fine
plz up vote
people downvoted because of opinion
 
Hi everyone, I am new to rust and I have few questions about cargo
I installed cargo, but it's not recognized in my terminal
That's the error I get
could not find Cargo.toml in /Users/makererror or any parent directory
 
to run a command like cargo build or cargo run, your current directory has to be inside of a cargo project. To create a cargo project you use cargo new or cargo init
this error you see is a lot like if you run a git command but are not inside a git repository
 
@Stargateur Me too, upvoted it. (And yes, I totally disagree with what the OP wants, but that doesn't make it a bad question actually.)
@PooyaPanahandeh I would highly recommend you to read The Cargo Book but what's more important of all, read The Rust Book
 
@Stargateur I must angrily agree with you. I removed my downvote, but I cannot upvote that.
 
3:31 PM
@turbulencetoo Thanks for your time
@PeterVaro Thanks for your time, these two links are really helpful
 
@PooyaPanahandeh No worries, start with the latter, and once you are familiar with the language, you can start mastering the tools around it (like cargo)
@PooyaPanahandeh Es amugy jo latni neha mas magyar arcot is errefele ;)
 
@PeterVaro okezsoke haverom vagyok magyar tetszik burad elek budapest sok ev szervusz szep nap
 
@FrenchBoiethios I only did it to balance out the downvotes, once they are all gone, I'll remove mine as well
 
 
1 hour later…
4:43 PM
"There is nothing wrong with this question". I disagree. The question is basically "I don't like how the language works tell me how how to make it work like java. Or don't tell me I don't care I'm gone as soon as I asked LOL". There wasn't even any trace of motivation or just a proper writing. Only shep's edit make it look normal
@Stargateur You just upvoted lazy and dumb trolling
And btw, shep's edit is a guess trying to instillate some sense in a question when we didn't even know what OP wanted.
 
Right, I haven't followed the history of the question, but as it is NOW, it makes perfect sense, even if I highly disagree with the OP's goal
If it is allowed by the language itself -- doesn't matter if that style is considered unidiomatic -- asking it to make it work is not really a bad thing
 
You mean shep's question ?
 
You mean the latest state of the question? Yes.
The fact of the matter is, one of the answers could/should explain how the language was designed and why it was considered to be a better thing to make it expression-based instead of a statement one.
In which case this question and its answers could be considered more than interesting.
 
5:11 PM
@DenysSéguret I don't agree I understand the question perfectly only with the present code
@DenysSéguret well, yes I still think rep loose/win should be symmetric
We all don't speak a perfect english
but the code was clean
Yes I'm aware of BTreeMap, and I know this is algorithmically optimal. I'm just asking about coding ergonomics - is there a shorter more elegant way to write it basically. — Timmmm 4 hours ago
some people really want magic
 
5:49 PM
@Stargateur Maybe, but it was already at -5 or maybe -6 when Shep rescued it. Some of those (including mine) were for the question quality, not its content.
There is a bandwagon effect, too, of course (people more likely to downvote a question if it's already negative)
 
6:09 PM
@trentcl I do not believe you
 
6:29 PM
bad question don't get -5 because grammar
 
of course, nobody cares about the grammar. The no effort and no motivation are good reasons though
 
 
5 hours later…
11:05 PM
wow SO make a css update
who care ?
 

« first day (1869 days earlier)      last day (1610 days later) »