« first day (2380 days earlier)      last day (1091 days later) » 

4:31 AM
5
A: Implement an Over function

Aiden4Rust, 21 bytes |f,g,x,y|g(f(x),f(y)) Try it online! An anonymous function that has the signature fn(fn(i32)->i32,fn(i32,i32)->i32,i32,i32)->i32 Don't you love it when the function signature is twice as long as the function itself?

 
 
3 hours later…
7:35 AM
Is there a zero cost clean pattern to ensure a struct isn't instantiated more than once (I don't want a singleton)
 
@DenysSéguret Whoah. Not that I know of.
 
In fact I don't think a really zero cost solution can exist in current rust. And we probably need at least a byte of storage at runtime too, and a runtime check.
 
Pretty much. If one could have a type which disappears after one use, that would enable the pattern.
But this is very unorthodox.
 
7:53 AM
Yes. I'll go with adding a line of comment explaining the struct shouldn't be instantiated more than once ^^
 
Good ol' comments. Some languages' best type system.
 
8:33 AM
@E_net4thecopycat Wish we would have Voldemort types, eh?
 
@PeterVaro Didn't we have those already?
Maybe not the same way as in D.
 
Sort of..
 
Closure types are often called that.
 
@DenysSéguret Can you tell us a bit more about what you're trying to achieve? There are several ways I could think of that might solve your problem, but they truly depends on your usecase, e.g. whether instantiation is done by you or by your users.
 
@DenysSéguret a singleton is a singleton... :p what you mean is "I want a singleton with zero cost"
 
8:41 AM
I have many structures that exist only once, because they store part of the state of app. There's usually no problem if they can conceptually be cloned, or anything. But there's a case when I look at a version for caching derived data, and the version could theoretically go wrong if there were 2 structures.
 
I don't think it's possible, even in C it's not really possible
 
A singleton with zero cost is easy, but I don't want to do that
 
@Stargateur Alleging that C is a very powerful language. x)
 
@E_net4thecopycat Depend what you call power... you can do anything in C
@DenysSéguret Oh you master magic ?
 
Well, I can almost imagine a weird solution: A macro which declares and defines the factory function in the global scope, then calls it. But I don't think this can be done in Rust.
 
8:44 AM
the only way to make it safe would be on bin, you can't in the application side
 
who wants safe ?
 
I'm even talking about C, for example what happen if you load a library at run time how to you ensure your singleton init get call ?
 
You can if you add to your code of conduct that any insertion of C code results in ear slapping.
 
I don't have time to go deeper right now (meeting) but basically you're right, the best you can do is like lazy_static & co
 
I heard there was a new next thing over lazy_static.
Something something once_{whatsthename} or {whatsthename}_once
 
8:51 AM
@DenysSéguret The way I would do it, is instantiate the struct myself, and only give away handlers (of which there could be many) which are all connecting to the same instance. Since you never expose the internal one it would be safe.
And yes, lazy_static or that other thing is the way to go for this.
@E_net4thecopycat OnceCell, right?
 
@PeterVaro O yes, that one!
 
Didn't anybody switch to it ? I've also stick to lazy_static because now I know it and it's for the lazy anyway ^^
 
TBF I haven't played with it myself, whenever I needed similar functionality in the past I used LS as well.. but I believe we should give OC a go (internally it uses LS anyway IIRC), and someone mentioned here, that OC might have a chance to get into the standard-library so getting familiar with it might be a good idea.
 
9:26 AM
Haha, that came up a while ago @E_net4thecopycat
Mar 3 at 13:27, by Jason
Is the usage of once_cell preferable to lazy_static? So far it seems so, unless I'm missing something?
I haven't looked into it more though.
 
The one obvious plus about once_cell is the ability to make lazy initialization without macros.
 
 
5 hours later…
2:18 PM
@PeterVaro I figured that out by the way and it was just my lack of knowledge of linking :shrug:
It required the shared object /usr/lib/libavcodec.so but it used /usr/local/lib/libavcodec.a during installation, so I'm assuming it wasn't properly removed at some point in time.
 
Well .a and .so are not for the same purpose! The former (traditionally) is the extension of static libraries (IIRC a stands for archive?), while the latter is for dynamic ones (IIRC so stands for shared object).
 
Yes, exactly!
 
So how did you solve at the end?
 
I think I should set some time aside to learn more about C.
 
@Jason Well, that will be a pretty long time XD But at least you could pick up the basics, how to configure and build / link objects together, etc.
(That's definitely needed when it comes to package and dependency management)
 
2:24 PM
@PeterVaro Ha, I, uh, deleted the .a files, thinking that I'd be okay with the .so files from ffmpeg-git. The latter was compiled using --enable-shared.
 
If you're actually interested in proper C (not just "tooling"), then there's hardly a better place to start then to read the C17/18 Standard. Hello of a read, but you can't truly do real C without an adequate knowledge of the standard.
 
@PeterVaro Yeah, I think it'd be useful in the context of Rust? There's so much written in C/C++.
 
Yeah, 60+ years of software XD
 
Haha, exactly
Thanks for the tip! I'm going to look into this.
 
I just tested Zellij: zellij.dev/news/beta It looks very good. And there's almost no overhead in rendering.
 
2:27 PM
Well, if you wish to learn C, start with an appropriate book, but keep in mind that most learning materials do not mention the standard or do not mention it enough.
 
Hopefully I won't come back shivering and screaming.
 
So, you know, once you have a bit of working knowledge, try to use the standard as frequently as you can.
 
Got it!
 
@Jason Oh you will mate, you will. There will be weeping and gnashing of the teeth
@DenysSéguret Is that supposed to be a Tmux alternative?
 
@DenysSéguret that looks interesting!
I think this is the first time I've seen the use of wasm to allow for extensibility using other languages, even though the idea of doing exactly that is mentioned often.
 
2:40 PM
@PeterVaro tmux is such a bag of bugs I wouldn't tag anything as a tmux alternative. But yes, the base features seem to be the same. But it looks like it wants to do more.
 
I believe you if you say so. TBH I've been using tmux for 7+ years and I love it and never once had it crashed on me, even though it is the most used application on my computer next to my terminal.
@DenysSéguret I don't like that aspect. KISS, and reduce features, that's the way to go. Delegate functionality to plugins and other programs. I got rid of all my CLI tools that wanted to be more than they should be. All my tools are doing one thing and one thing only.
I truly appreciate the wisdom of the UNIX philosophy. (As you can tell.) 'tis a shame not more engineer do ;)
 
I hope that's delegated to the plugin functionality they mention. I'll give it a try this evening @DenysSéguret.
 
I will as well, really looking forward to it actually! (Cheers for the share Denys!)
 
In case anybody was thinking IBM was a decent place: git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/…
 
Oh, wow.
 
2:53 PM
I would never ever join a place which owns my soul essentially.
 
@DenysSéguret ... Wait, what in the actual «expletive».
Dayum, real blacklist material there.
 
3:13 PM
hello everyone
I am wrapping up many projects that I will be soon* publishing, hence I would appreciate any feedback for those who have enjoyed reading the two readme/books:

* The first One, a tribute to Dennis Ritchie's language, aiming to help developers to get a better understanding of C language and programming in general, as well as giving some insights about 42 School: https://lnkd.in/dQkNpau .

* The second One is intended to provide most efficient and elegant solutions for algorithm problems used in competitive programming (C++ mainly, but easy to transpose to any language): https://lnkd.in/dikXZ
 
GOOOOB MORNINGS!
I've had one (1) coffee and I feel like climbing the everest, but I think I'll rather troll folks here a bit then calm down
 
please do
its the morning in France?
 
@AntoninGAVREL Canada, I think.
 
canada indeed
@AntoninGAVREL I'm in the very nice situation of being a french-canadian, both the sorriest and most pretentious canadians
(evidently, I'll let you consider from where the pretentious part comes)
 
@AntoninGAVREL Oh, you made 42 ?
 
3:26 PM
I was there for a short period as I already had a Master in Finance
and working for various financial institutions
but I want to have a meaningful existence, I don't think being the pawn of the financial system would help me reaching that goal ;)
@FélixGagnon-Grenier I really love Canada, especially Toronto
(NB: Canada, not Canadians) ;) /taunt
Do you think its difficult to build your own streaming protocol in Rust?
that would be the next step in my project
also has anyone tried to have Rust interfacing with VLC? github.com/garkimasera/vlc-rs
 
@AntoninGAVREL I think you got the saying wrong
"la france c'est bien, le seul problème c'est les français.es"
@AntoninGAVREL I think the "difficulty choking point" would reside more in the designing and "pre-coding steps" rather than the technical difficulty of Rust
 
@FélixGagnon-Grenier This one exists in all languages for all countries...
 
that's exactly what a french person would say
 
3:48 PM
I often do this:
            let mut cw = CropWriter::new(w, width);
            let cw = &mut cw;
I feel like I'm missing a shortcut
 
@DenysSéguret No <mod> + <non-char-key> as far as I can tell :(
 
@FélixGagnon-Grenier we akso have Paris version ;)
 
4:17 PM
since a lot of Unix users
what is your recommendation for mp3 player?
 
github1s.com migth be cool, especially for vsc users. See github1s.com/Canop/broot
 
for mp3?...
 
@AntoninGAVREL I use MOC, before that I used CMUS
 
what about winamp
 
I think the former is far superior, but non are truly great in terms of control/UX, but they have very good sound quality
 
4:25 PM
It really whips the llama's ass!
Sorry
 
@DenysSéguret what the actual fuck
@AntoninGAVREL morning is when someone wakeup
 
@DenysSéguret the date must be wrong, it says 2021-04-19 /s
 
by the way this kind of thing is totally illegal in France
 
5:05 PM
what is illegal
Canadians?
They are not things, but human beings
 
5:29 PM
oh nice
@AntoninGAVREL how very magnanimous of yours :P
 
<3 maple syrup no worries
I was wondering if there was a difference between gold, amber and dark maple syrup the other day, if you can enlight me (well I could google as well, but nothing replace the opinion of a Canadian on maple syrup)
 
6:18 PM
posted on April 20, 2021 by Guillaume Gomez

Hello everyone, please welcome Jacob Hoffman-Andrews to the rustdoc team! Jacob Hoffman-Andrews (@jsha) has been contributing a lot on rustdoc front-end. Thanks to him, the pageload of the rustdoc pages is much faster. Here is a non-exhaustive list of the stuff he's done recently: The huge search index is now only loaded when needed. The pageload has has been optimized a bunch. Rustdoc's sho

 
6:35 PM
any idea to create an integer with n bits alternating 1 and 0 or 0 and 1?
example n = 8 -> 10101010
or 1010101010101010
 
6:50 PM
Is the site trying to tell me something ?
 
Yes its a polite way to tell you that you are not contributing enough
 
Encore du travail, grunt
just sold 3 ETH for 5700 euros
feels good
I hope it will not double up or I will feel slightly bad
 
Damn. One more time I pasted the wrong code in an SO answer because it's hard to copy from the playground in vi mode...
 
you should use emacs
/popcorn
 

« first day (2380 days earlier)      last day (1091 days later) »