« first day (1856 days earlier)      last day (1853 days later) » 

06:12
@E_net4istired XD
 
2 hours later…
08:09
> As for threads. Not even Rust is 100% safe. I don't think any language is going to solve this so that any old fool can mash data between threads in a safe manner. Whether a language is 60% safe or 40% safe, it will still crash in front of a client .
Lol, TIL
7 Rust questions in the last 24 hours: one bad and six terrible
08:32
@Stargateur Indeed.
@FrenchBoiethios look like he think you can patch c++ to have similar safety than rust
It's hard to explain that Rust isn't better than C++ when you don't want to learn Rust and thus have no idea what you're talking about...
09:22
People are often the mouth full of shiet when it comes to Rust. I've never seen a language carrying such jerk/hate with it.
PHP ?
but it deserve it ^^
@Stargateur Someone gave him a 3 lines modern C++ code that segfaults, and he's like "Yeah, don't you know debuggers?" Well I don't need debuggers to investigate segfaults in safe Rust…
@Stargateur Agreed, but the hate is factual and well-deserved :P
@FrenchBoiethios I'm a C coder I never use debugger...
well just valgrind
@Stargateur You don't debug step by step? I don't even know if I can develop without that ^^
@FrenchBoiethios I look the code
09:37
If you see the runtime values by looking at the code, you're using a debugger, ya know?
I think what he meant was: looking at the code and he can tell if it works or not ;)
@FrenchBoiethios haha true
Debugging is no easy skill despite the cool tools that we have. But IMHO overusing instead of think about your code is just as bad as not using it at all.
@FrenchBoiethios Some people feel attacked. When they're C/C++ experts and they're told that there's a better solution, either they look seriously at it or they start to fire at random.
@DenysSéguret But that's very much understandable, don't you think? "Mastering" C++ (if that's even possible.. spoiler: not) takes years of investment of your time. Now once you think you know it, and you spent a considerable amount of time working with it and then it turns out there's a far better solution out there that could do everything you do, but in a clear and simple way, and you could master it in less than a year -- how would you feel?
09:43
Of course it's understandable.
I would sort of feel betrayed. Betrayed by the industry, that forced me to learn and master something that is a hot pile of garbage, and spend the best years of my youth tearing my hair out when a code written in it needs to be maintained..
How I would feel ? I just never stop to learn... I have no problem with better things incoming. I hope Rust will be replaced soon enough with something better. In fact I don't think it's even needed to answer people who stay on the defensive. From my experience they discredite and ridicule themselves in meetings. Smart C++ experts in my company, on the other hand, come to me to learn.
I think true programmer can code with any language ofc you need to adapt to a new standard name, environment etc but a good coder is a good coder in any language
@DenysSéguret Oh yeah, I agree with you on that, I don't want to be in the way of any language development -- if something better comes than Rust, I'm ready to ditch Rust in a blink of an eye in favour of an improved solution. That being said, if I could choose today, I wouldn't touch any C or C++ anymore -- I had my fair share learning, understanding, and fighting, and heck, even advocating those languages..
@Stargateur I don't think anyone questioned that -- in fact, I dare to say, it wouldn't even matter for a good engineer, if they would only have assembly and they have to figure out their own calling conventions and function-abstractions, etc.
Yet, if they could, they would still choose the best possible tool for the job
To make their own lives easier -- because a good engineer does NOT trust in their own abilities. If there's something a machine could do better than me, why should I try doing it in the first place? (Code generation, optimisation, static analysis, etc.)
"a good engineer does NOT trust in their own abilities" meh, he should but estimate its own skill is hard
09:56
what I meant was: human beings suck at programming
that's that.
we are bad at it, yet we have to do it -- and heck, we even enjoy doing it
:)
but if you could build a tool that helps you where you fail (lack of concentration, limited capacity of storing all sorts of information, influenced by the weather and other mood-shaping factors, etc.)
why wouldn't you want to use those over your very unreliable memory and other limited capabilities?
@PeterVaro I don't agree at all
code generation optimisation all of that is still human made
@PeterVaro because that where creativity come from
@PeterVaro That was my case. I've invested intensively 2 years or so in the C++ (not as much as an expert could do, sure, but that's quite a long time…). As soon as I've discovered Rust and understood its strength, I've just put the C++ down.
And I won't ever write a line in C++ again
10:12
I like recursive C++ template ^^
You mean CRTP?
@Stargateur You have every right to disagree, but I can guarantee that you will have a very hard time in this industry ;)
I can't say I don't know every word people use
@Stargateur There's no contradiction there!
@Stargateur You know, that I was an Industrial and Product Designer and I even studied and taught Jewellery Design for years before I started professionally coding? With that artistic background, I would still argue, that "creativity" and "ideas" and sorts of stuff could be generated, and we are barely more than some high functioning, super sensitive, and ultra complex biological machines who are just following code implanted into them, effected by the mercy of their surroundings.
(But this topic is more of philosophy than anything. What I meant was -- I don't think there's anything special about "human creativity" that could not be reproduced one day by machines built by us)
@FrenchBoiethios Unless you have to deal with some legacy at work -- I don't see any compelling reasons to continue working with it either
anyway, I'll bbl, I have to cycle now ;)
@PeterVaro That is because I consider code as art, I don't know draw, I don't know play music but I know how to make beautiful code. When I say creativity in this context I mean find a clean way to do something in a code. What system can I create that make this in a logical way. When you see some code and you think: "This is perfect, I can't make it better"
10:21
related: I need somebody to draw me a termite with the mad hatter's hat, to be used as a svg logo for termimad
Absolutely totally normal request, nothing to see here
10:42
I guess I'll have to do it myself
Termimad today isn't really consistent with the other ones here: dystroy.org
@Stargateur Code is art and it is not that different from drawing, painting, sculpting or composing music -- to name a few things, which I have plenty of experience with and some of which I still do today. However, when you say "this painting is perfect, I couldn't make it better myself" or when you say "this code is perfect, I couldn't make it better myself" you are just following rules, most of them we artists/engineers all agree on, some are your own subjective ones, but the judgement
remains "an automated test through a bunch scenarios"
and if there are rules, then those rules could be turned into well defined specifications
and well defined specifications could be turned into "machine code", something a device can execute
and if that's the case, then art is just a very sophisticated, super complex set of rules
similar to what human beings are themselves
but that doesn't mean by any means, that it could not be mapped out completely, turned into specification, and built by human beings
which will not make any of these less impressive
but it would arguably remove the magic around it -- the same way as our understanding of the universe as it is today (which is still very, very limited) made it less magical then what people believed in even just a century ago
@DenysSéguret didn't you create all the other logos yourself?
@PeterVaro yes I did. But it's hard to me and I fear what I'll achieve on this one...
 
1 hour later…
12:01
@PeterVaro programming's closest "real life" analogy is the work of an architect
@SébastienRenauld I never liked architects myself -- they are smug folks.. I mean, they are the kind of people who think they are clever enough to design everything, starting from cutlery throughout houses until mega cities. I'm not joking, these things happened in the first half of the last century, when the "starchitects" actually designed the forks, the knives, the beds, the window frames, the lights, the garden, the parks, the transport, the city structures -- all in one project. Megalomaniacs.
So if anything, I love thinking about us as mechanical engineers.
I agree that I want something better than Rust to come along, but I do hope that we get a few (10?) years out of it before we get the next thing. For selfish reasons as well as time to actually learn what lessons we need.
Those are nice and decent folks. And the closest in terms of applied-arts are the industrial product designers.
@Shepmaster Tbf, I think Rust will last at least 10 years -- I mean, as the reference says somewhere, Rust is not a particularly inventive language (I would a argue a bit about this modesty, still) and as such it took all the greatest ideas of the last half a century and put them together in a neat package
thus, I don't think it will go away anytime soon
and if we could keep Rust as fresh as it is today (e.g. not restrict it with a standard per se) then I don't see any reason why it couldn't evolve and last for even more than a decade or two
@PeterVaro you're saying that - software developers often have the same flaw
I've had a software engineer attempt to dictate hardware rules recently
new protocol this and new protocol that and new way of doing this and new way of doing that and didn't you hear about relay 2.0?
12:18
@SébastienRenauld yeah, but there's a hug difference there (though you could argue about where the boundaries are): if you are thinking in terms of "products" then the biggest products we have currently are houses. The design of those are the so called "integrated designs" which involves a huge amount of knowledge, loads of disciplines, etc. But, it is still one, whole unit. One block. In that block, things affecting each other more naturally, the same way as software would hardware or the other
way around. However, cities, are like networks of devices.
They need management, but they are not a single, integrated product. Not one unit.
Look at how fucked up the designed cities of the US became, compared the natural evolution of the european cities. There's a brilliant talk about that I heard years ago, let me search for it!
(Amazing, I just realised that I saved this link 10 years ago.. Time is running much faster than I could appreciate it..)
13:02
@PeterVaro hug differences are my favorite though
@PeterVaro That's not even a pure question of technique: in France (at least) one earn more developing a site or an API with DOTNET or Node than a guy doing high performance trading or some highly specialized industry algorithms in C++.
13:18
@Shepmaster haha, when I read back my typo the time for editing a comment already ran out.. :/
I like it this way
@FrenchBoiethios I think that's a global phenomenon -- sadly :( Here in the UK, the same happens, or back in Hungary, I saw the exact same stuff..
13:51
Ugh
Where's that question that boils down to collection.iter().map(|idx| &other_collection[idx])
ah
1
Q: How to create an iterator for a vector that yields elements specified by list of nonconsecutive indices in Rust?

wyer33Is there a concise way to iterate over a vector using a given list of nonconsecutive indices? I have code that looks similar to this: fn main() { // Create a vector let v = vec![0.1, 1.2, 2.3, 3.4, 4.5, 5.6, 7.8]; // Create a series of indices let i = vec![3, 4, 2, 1]; // I...

 
1 hour later…
14:58
@PeterVaro supply and demand
@SébastienRenauld I hate capitalism so much. Before you ask me, no, I don't have any viable alternative, but this is definitely not the answer.
Totally agree with you, but then again for every business trying to become the Uber for X, you need all the stack and people have a propensity to reinvent the wheel, adding costs and man-hours as a result
vs. HFT is pretty static, relatively well understood and you don't just go in gung-ho and rewrite everything all at once if you want to get into that
I have a few horror stories from last week on the former
don't hesitate sharing those!
Scaling pains on a company
they're making the quick choices rather than making the right choices
trying to nudge them into the right path but it's difficult
15:16
During the last decade of my life if there's one thing I learnt then that is: the business side of any project is not really a friend of any kind of 1. improvements/innovation/creativity/etc, 2. engineering/scientific approach/long-term planning/etc. 3. product/customer/employee vision/maintainability/sustainability/well-being
So the question quite naturally raises itself -- and sorry for my french -- but why the fuck are we enslaved this world and our society around business decisions and giving the control to people who's only goal is to maintain and/or increase their power and push or keep everything on the business layer because that's the only thing they are able to control?
So yeah, I rather hate capitalism.
(And I honestly don't understand engineers who advocate that we should not write good software for the sake of engineering but only if the business demands it -- there's always an article like this on HN every other month.. I would blindly call these writings an act of betrayal of our profession, really.)
2
15:48
@PeterVaro "capitalism" or as you mean, the market law, is the way things work, that's all. If everybody want a thing, its price is high; if nobody wants it, it is low.
16:01
@FrenchBoiethios They don't have to work like that, you know. I mean, the prices are not self-regulating even if they do seem like -- most of the prices we pay for things are artificially kept at certain levels. Either because some products/companies/segments don't have proper competitors, OR because they are regulated/helped by governments and/or other beneficiary parties.
and when I said "I mean" what I really wanted to say is that there were lots of other systems which were not great either, but where the above mentioned "evolutionary"/"natural" rules didn't apply (think about communism for instance -- which was also artificially kept alive, but that's a different story)
 
2 hours later…
18:29
woah
Sara Chipps on November 13, 2019

In my very first blog post, I wrote about what a personal experience taught me about the Stack Overflow community. I said we were going to step back and re-evaluate how we deliver feedback, how we can improve content quality, and how we can reduce friction between people. I said that our goal is to have the question asking process be painless and beneficial for new people and Stack Overflow veterans alike.    

During this re-evaluation period, we noticed something in our reputation reward system. We give anyone who receives an upvote on an answer ten additional reputation points, but only give five reputation points to people who receive an upvote on a question.  …

Yeah... what do you all think?
I fear this will result in another meta shitstorm :/
Also: when does it get recalculated? Starting immediately? Would be interested how long this process is expected to take.
@Shepmaster 🤦
18:46
@LukasKalbertodt I've got no real anger at this.
I wonder if we can see the delta
I mean, we are still gonna downvote bad questions
@Shepmaster ROFL -- that's the right attitude ;)
This just means that good questions will earn more points.
@PeterVaro Why that emoji?
@LukasKalbertodt Because I don't think this is the most important/burning problem needs solving, I mean, I don't think it will make any of our lives easier/better. It will be now easier for anyone to start answering because you gain more points from asking, which would result in more shitty answers -- to pick one (possible) consequence
(sorry for the pings.. I should pay more attention when I'm writing my comment.. :/ )
@PeterVaro You can (usually) answer with 1 rep, so I don't think that's relevant..
18:53
@Shepmaster really? it wasn't always like that, was it?
IIRC you needed 20+ rep to post an answer
and it was free to ask a question
(maybe that's changed and I missed it)
> The most basic privilege of all -- the right to ask a question, and the right to contribute an answer. This is generally available to everyone, regardless of reputation level.
I don't recall a time otherwise, but wouldn't rule it being different at some point
Am I confused about the privilege to talk in the chat rooms?
oh glob, my memory is getting foggier and foggier by the minute..
Anyway, I stand corrected, in which case my main problem still remains: I don't think this is the most burning issue SO should solve..
Which is indeed 20
18:57
yup, thanks, I totally forgot about the first steps..
Ooh, and the asking question changes have landed
Ugh. Hacker News, why do you do this?
@Shepmaster /me shaking his head
> Looks like the submitter has an agenda against SO
> [flagged] [dead]
good response times
19:17
@PeterVaro Mh yeah, that might be. But it's not like only tackling the most important issues is worth it, right?
@Shepmaster Some people...
@LukasKalbertodt Right after the last shitstorm? They should've picked something actually meaningful if you ask me.
@PeterVaro I have to admit that I am not well informed about the recent meta drama. I actually try to get as far away from it as possible. That's way less stressful, I imagine.
Oh my god... SO is making votes on question the same value than votes on answers
They're just killing themselves...
19:32
so, when are we going to start building a SO alternative in Rust then? ;)
@DenysSéguret Can't tell if irony or not
Didn't you receive the email ?
> Any question upvote earned in the past will be awarded a value of 10 reputation points.
psst, scroll up a bit
yeah... did it...
I'm just so shocked by the betrayal
@DenysSéguret What betrayal?
And sorry, I'm not trying to be annoying. I am really interested in why you think that. It's just that for many months (if not years), basically every change done by SO has been shat on very vocally. It always resulted in some kind of drama. And I just don't see the point of all these negative responses. I'm mostly indifferent to most changes.
19:44
To start with, it's just another change meant at increasing the traffic and number of users by accepting to drop both the overall quality and the morality behind the system. The rule which motivated us all at the beginning was simple: the reputation was also a kind of measure of some abilities in programming and solving problems, not just at asking the same SEO tailored questions again and again. It's a contract change meant for short term user growth.
If the stupid flow of identical questions doesn't stop, we won't want to answer questions.
@LukasKalbertodt it is already a shitstorm.
The reason it is a shitstorm isn't for the rep gain, because nobody gives a shit. It is because this change was not a feature request, was never put for discussion, got leaked by a moderator, then SE went through the trouble of unleaking all copies of it, and then this happens.
the shitstorm isn't due to the change, it is due to the fact that SE can go through the trouble of literally petitioning every image hoster to unlist a copy of the leak, but they can't even ask their own community for approval
this too
Announcing this like this, after years of SO being based on a community... is so infuriating... It's just like a new management totally unaware of how a company works and doing things at random
You're the product now, friend
@DenysSéguret Don't you think that's a too negative view of the change? I mean maybe I'm naive, but their reasoning in the blog at least partially makes sense to me. And I don't really see how this change would lead to the bad things you mentioned. Why would the quality necessarily drop? Users writing bad quality questions for rep? Those questions won't be upvoted and they can do the same with answers today already.
@SébastienRenauld Yeah, that sucks, I agree. I also totally hate when communities are ignored. I am totally on your side regarding this.
I personally literally could not care less if answers or questions get more or less rep as long as sockpuppeting is in check.
However, I do care a lot in the fact that it looks like Sara Chipps is literally doing everything she can to prop herself up and kill the community at the same time
19:58
Remember that question downvotes aren't doubled
@DenysSéguret that's the only part of it I dislike
I already disliked that one upvote and one downvote resulted in positive rep
@DenysSéguret How much is a question downvote now btw?
not significant enough
votes on Q: +5 / -2
after the change, it appears to be +10 / -2
@Shepmaster Thanks! For answers it is +10 / -2, too right?
20:02
> The fact is that the changes made back in 2010 simply weren't having the intended effect of improving question quality. Reducing the amount of reputation gained from upvotes on questions did little or nothing to address the problem of users earning reputation from low-quality questions. Worse, it merely served to make it that much harder for users who were asking useful, high-quality questions to earn privileges.

Data tells us plainly that voting skews heavily towards answers. Even if the net reputation gains are made equal (as they will now be), folks who write good answers will still b
12
A: What was the context of the decision to lower the value of upvotes to a question?

Cody GrayThe decision was made way back in 2010 by Jeff Atwood, one of the site's founders. (He has since moved on to other pursuits.) It was announced and explained in the blog post, "Important Reputation Rule Changes": […] question upvotes will now grant only +5 rep instead of +10.* There is no chan...

Hey all. I am learning Rust. Am I correct that all parameter values AND the return type must have a size known at compile time? And when it is not known I can use a pointer which have a fixed size and is therefore known at compile time?
@J.Doe Hey :) Yep, that's correct. Basically.
@J.Doe Reference, and yes
Ok, thanks guys!
I think unsized locals are already available on nightly. They are at least proposed somewhere. But yes, until now, only Sized arguments and return types are allowed.
@J.Doe And also, just to be clear, "pointer" can be many things right? In particular, you don't need to use raw pointers. You can use references, Box, even Vec
20:05
Yep, that was going to be my comment. The sized restriction is true now
and there's some places it can / might be lifted in the future.
@LukasKalbertodt it's unfortunate that we use "reference" and "pointer" both as concepts and concrete ideas
@Shepmaster where can it be lifted ?
@Shepmaster Yip, indeed. (Spoken) language is hard :)
Yes, I mean the & operator when referring to a pointer :)
> Allow for local variables, function arguments, and some expressions to have an unsized type, and implement it by storing the temporaries in variably-sized allocas.

Have repeat expressions with a length that captures local variables be such an expression, returning an [T] slice.
20:07
thanks... reading...
beta, pfft
nightly, stable, or GTFO
@J.Doe In most cases, you'll be creating a reference with that operator
@DenysSéguret @LukasKalbertodt we actually already have unsized locals today in one specific place — remember where?
@Shepmaster I confused 'pointer' with 'reference' indeed
@Shepmaster And because of that no one tested stuff on beta, and because of that we had stable regressions in the past, and because of that they now do a crater run for each release :D
@Shepmaster Ho ho ho, hold up. Most cases? Are you talking type coercion? Because the operator alone (without coercion) always creates references, right? Am I missing sometihng?
@Shepmaster extern types?
@LukasKalbertodt yeah, coercion is what I had in mind. fn foo(*const Bar) {} foo(&Bar);
@LukasKalbertodt Box<dyn FnOnce>
@Shepmaster Oh right, I remember that RFC! Less boilerplate in unsafe code <3
@Shepmaster Ah right! Good call
20:12
@LukasKalbertodt also avoiding UB at all in some cases
@Shepmaster Oh okay... I guess for mutable references?
@J.Doe What programming languages do you know already, if I may ask?
@LukasKalbertodt IIRC, yeah. Also implementing offsetof
@Shepmaster Ooohhhh yeah. Nice example.
@LukasKalbertodt (stolen from the RFC)
@LukasKalbertodt I really like Swift :) it's my favorite language because I program already a few years in it. Because I programmed a lot in it, I got into object oriented programming and stuff and got a job in Java now, pretty cool language with really awesome reflection capabilities. Besides that some SQL and just little knowledge in frontend languages. I am learning Rust because I want to build a server, but not in Java (because obvious reasons). So I am about a week into Rust now, I come
across a lot of similarities in both languages! I am exciting to learn more Rust and try to combine them in away where Swift is my front end language and Rust my backend language.
20:17
@J.Doe I don't think there are many people who start in Swift then try Java and think "wow!", so keep up that optimism!
@Shepmaster ofcourse, really a lot of things are not available in Java (generic enum for example...). That sucks. As I mentioned, reflection is a thousand times better in Java than for Swift! Rust also have conditional conformance for traits from which I saw, awesome! So an impl block for a generic trait when the generic type over the trait is from a specific trait (hope I am clear enough).
Although I kinda miss named parameters atm :(
@J.Doe Yeah indeed, Swift and Rust share some interesting similarities.
@Shepmaster Oo no I think I am not clear. I ultimatly want to make an app, written in Swift. Since I want to have an online database, I need a server. I want to write the server in Rust! I thought about some time to either write it in Elixir, Rust or Swift Server. I didn't choose Swift Server because I think it doesn't exists for to long to take into production. The community of Elixir is pretty small, so I went with Rust because it looks promising :)
Lots of Reddit followers, really active github page, the most beloved language for 4 years in a row chosen by stackoverflow developers, etc.
@LukasKalbertodt Yea a lot. I think closures are more readable in Swift, but than again, Swift has ARC (not to confuse with Rust's Arc) which maybe make it somehow easier to write certain things. And... fields in protocols, awesome! I saw a RFC in Rust for fields in traits though. I hope it will be implemented someday
20:33
@J.Doe To me, it's not materially different. You'd presumably use JSON and HTTP while xi uses whatever format and transport, but it's the same idea.
@J.Doe What is Swift's syntax for closures? Rust closures seem super readable to me :D
@Shepmaster I use protobuf actually, but it's the same idea. Well I think Rust is a great choice with lots of potential (sadly, no jobs nearby my town in Rust)
@LukasKalbertodt something like this: let myClosureOneArgumentOneReturnFunction: (Bool) -> (Int) = { myBoolean in 5 }
Whereas 'in' is the replacement of the vertical pipes in Rust
In Rust we need to declare the types of closures I thought, I came across FnOnce or something. Than again, I am at chapter 12 of the Rust ebook, so I need to understand closures more in Rust, maybe my chats are not valid :P
There's syntax for accepting a closure (declaring the parameter) and syntax for creating one.
The latter is pretty succinct:
iterator.map(|val| val + 1)
//           ^^^^^^^^^^^^^
O and mapping over a array is more easier in Swift: let myArrayPlusOne = myArray { $0 += 1 }. In Rust when using a Vec, I read we need to turn it into an iterator, do the same map operation and than collect it while annotating it with a type because the collect method is implemented in a lot of traits, causing a type conflict.
Woops, forgot to add the .map after myArray
the implementation of map might look like fn map(self, f: impl Fn(ArgType) -> retType)
20:39
@Shepmaster O, that looks pretty decent :) I think I need to read and practice more Rust :)
@J.Doe The two approaches have different benefits though. An iterator is a fundamental abstraction in Rust. In Swift, what would mapping then filtering the vector look like?
6
Q: Why doesn't Vec implement the Iterator trait?

sgeWhat is the design reason for Vec not implementing the Iterator trait? Having to always call iter() on all vectors and slices makes for longer lines of code. Example: let rx = xs.iter().zip(ys.iter()); compared to Scala: val rx = xs.zip(ys)

In Java and Rust there is the concept of an array and a List. In Rust, there is an array and a Vec. In Swift, we just have an array. It can grow dynamically in size (if mutable). So there is not really a concept of Vec in Swift
@J.Doe That closure syntax really foncuses me and I think Rust's one makes more sense :P But ... that's just what we are used to
@LukasKalbertodt yea I guess so, it's what we are used to makes more sense :)
@J.Doe well, s/Vec/array/ then. My question is mostly about composing a map and filter operation
> foncuses
ಠ_ಠ
20:43
@Shepmaster in Swift we can combine the two with compactMap! developer.apple.com/documentation/swift/sequence/…
Its really just a map and a filter
@J.Doe and then how do you map the result of that (etc.) You can hopefully see where I'm going
In Rust, you get an iterator, then can compose all of the iterator methods, then come back to a collection (potentially different from what you started with)
so you can do
vec![1, 2, 3].into_iter().map(|x| x + 100).filter(|y| y < 40).collect::<HashSet<_>>()
Both are valid approaches
@Shepmaster Swift's code: Set([1, 2, 3].map { $0 + 100 }.filter { $0 < 40 })
I understand what you mean. compactMap is mapping an element to another element, filtering out the nil elements
So if a transformation ends, you won't see it in the array it created
ends = fails
I don't see any benefit turning a Vec into an iterator first and later on collecting it. I just seems like 2 unnecessary calls. Maybe I need to learn more about Rust to know why they implemented it like this
(Because I am used in Swift I don't have to do all this kind of stuff)
@J.Doe How many arrays are created in that code?
@Shepmaster Pfoe I am not sure. I can run a quick benchmark in Xcode though on a large array.
My guess would be 3: [1,2,3], result of map, result of filter (and add in the Set construction)
whereas the Rust version creates 1 Vec (vec![1,2,3]) and 1 HashSet
15
Q: Why and when to use lazy with Array in Swift?

Deep Arora[1, 2, 3, -1, -2].filter({ $0 > 0 }).count // => 3 [1, 2, 3, -1, -2].lazy.filter({ $0 > 0 }).count // => 3 What is the advantage of adding lazy to the second statement. As per my understanding, when lazy variable is used, memory is initialized to that variable at the time when it used. How doe...

looks like it ^
20:57
Wait - Swift's default map/filters aren't lazy?
Ick
I have zero actual Swift knowledge, I'm just parroting what I found
O yes, in Swift it returns just a brand new array. Map for example returns an array, and the compactMap link I provided also returns an array (see the return type)
In the code I provided, Swift created 3 arrays and 1 set
All elements in Swift are copied, but efficient for as far as I can remember. So if I say let a = anotherElement, it looks like anotherElement is copied inside a. But when I don't do anything with a, it just points to that array
Mmmm. Yeah, see, it was a little odd needing the .iter in rust, coming from C# (where the interface that allows for the map/filter operations simply requires a method which provides the iterator), but everything else was very similar. Lazy iteration is definitely an advantage, because of the ability to optimize & inline and not have additional allocations.
But not really sure about copy behavior when dealing with swift arrays though. It's pretty cool that Rust is more efficient and not just creates array. I am sure though Swift makes it pretty efficient to by not coping every element, since Swift is a pretty fast language to from as far as I can remember
Oh, I've heard swift is fairly performant. But in the scheme of UI applications, almost anything is 'fast enough'.
21:05
@Zarenor Yes, when using Swift you most likely are developing an application for a single user. It doesn't have to be that performant to make a UI that doesn't lag. Server side languages like Rust are different ofcourse and must be able to handle potentially a large number of users, so it must work efficient
You say that, and I just think of my poor phones battery life. Efficiency is good everywhere :-)
Heh. Oh, I realize. It's one reason I'm so excited for Rust GUI. And somewhat disappointed that several of them are basically running a browser render engine.
But in terms of responsiveness, 16.6ms is quite a lot of time, in today's terms
For doing what operation?
Huh? 16.6 ms is the inter-frame time for 60fps/60hz
Haha I like the 'shepmaster-fanclub' tag on this room
21:09
~16.6
O I thought you were referring to a operation on an array in Swift, nevermind
@Zarenor 144Hz or GTFO
@J.Doe there was a period where almost everyone had kirby-themed avatars as well
I might be a bit... enthusiastic about SO + Rust
That's great, contributing to the community! You are on reddit?
Almsot 80k Rustaceans on there
@J.Doe I have an account and read Reddit, but tend to stay away from r/rust
I ask my design questions there, because on SO I get downvotes and it will be closed because 'primairy-opinion based' or something like that. Ofcourse, SO's rules, but than again, I want to ask a community how they think about something, so I go to reddit for that kind of questions
You don't like reddit for a reason?
But I think I can ask more small/design questions inside this chat
21:17
Not every good question is good for SO, that's exact. And /r/rust and users.rust-lang also have their role. And this chat too
@Shepmaster I have a more generic question for you, but it has a relevance to Rust
If you had microservices, some in Rust, some in JS... How would you make sure authentication logic is not duplicated?
I'm tempted to suggest middleware-as-a-microservice but there must be cleaner ways
@J.Doe Yes, SO has a higher bar, which is part of the reason I like it. It's expected to provide code that repros the problem, for example. I also like it because it's better for dealing with duplicates. Most other systems have people just answer the same thing over and over and over
@J.Doe sure, or Reddit or Discord or URLO. There are a lot of places for that more informal discussion
Which is what @DenysSéguret just said...
@SébastienRenauld that's where my mind went first as well; what's unclean about it?
@Shepmaster that's true, I find a balance in using all the communities. I gotta go, let's finish part 12 of the Rust ebook :). Nice speaking to all you guys, bye!
@SébastienRenauld sounds broadly similar to rust-lang.org/static/pdfs/Rust-npm-Whitepaper.pdf
@Shepmaster XD You can't see the difference anyway
21:26
My eyes vibrate at the fundamental frequency of the universe
which way the causation?
@Shepmaster It still forces you to write (smaller) compat layers to handle tokens
I was thinking of leveraging OAuth2 on this
A=432hz, maaaaaaan
You can, like, feel it.
The numerology.
I have a full implementation of an openID connect provider left over from a previous project, so I can get that going quickly, but I'm trying to think of a convincing way to get them to agree to it
they view the gatekeeping microservice as cruft due to the fact that you've essentially shifted half of the concerns away (which is the entire purpose - your business logic should be fed authorization claims, not have to derive them every time in every place)
The two things I see are: a pass-through authentication. Every request hits auth service, it does what it needs to, then calls underlying service with the ID or whatever as a header and then it just trusts it.
you could also do a side-loaded authentication
every request hits the real service, which makes a simpler request to another service that does auth.
21:32
In retrospect I'm not so happy with all the OAuth I've added, a long time ago, to my apps. It adds more failure points, more dependence to external services (and the changing way they interpret the loosy standard) and it makes me less capable of rescuing users having lost their authentication at google or elsewhere.
@DenysSéguret I've encountered similar problems but the failure points tend to exist no matter what happens; the third party service reliance I never had because I never needed to support outside auth
as in, I always was my own provider
yes, it's just the usual benefits and problems of shifting responsibility
I was enthusiastic at first, 7 years ago. Now I'm less.
@Shepmaster the worst is, if it's the first one I can literally automate all of it in k8s
have a sidecar process do the mediation
@DenysSéguret Same, but it did do some good - it got rid of OAuth1, for a start, which was even more problematic
21:39
oh yes
And I've dealt with (credible) self made authentication since the beginning of the web so I was clearly convinced not everybody should build this kind of chain
But I still need from time to time to rely on social authentication to salvage accounts (thankfully most miaou users physically know some other ones, so it's doable)
22:21
Hi guys. play.rust-lang.org/… doesn't run of a compile error. I can see variable x is of type '&&i32'. I can not find anything related to '&&' because the same symbols are used for an AND. I would expect this to be called 'double borrow' or something, but google doesn't really help me out. I can make type x explicitly &i32 and it works, but I want to know: what is '&&i32'? Is it in the context of the gist:
A reference to instance f AND a reference to the field x?
So like two references in 1 variable? It doesn't point directly to y, but rather indirectly through the f instance?
Don't you want x = *f.x; ?
I am just messing with Rust a little, trying to figure out how things work and than I came across this compile error and I want to figure out what the &&i32 type is and how it is referenced
if you want to keep a reference (or a double reference), you need the referenced thing to be kept around. You can't keep a reference to something that goes away at the end of block
Yes ok, so what I expect. To me, it looks like x = &f.x; says: assign the reference of field x on instance f to local variable x. Turns out is doing a double borrow or something like that
J Doe no you're exactly right, local variable x is is a reference to f's field x.
and f's field x is a reference to an integer stored elsewhere
22:32
A yes ok, I think I get it. Thanks
In rust you don't usually play with direct handles, or double references. There's no need to
It's worth mentioning: They do happen in odd circumstances, but that's also abstracted away, because of the automatic referencing and dereferencing behavior.
Rust will automatically insert a first reference (add a layer of indirection where there are none) in some particular circumstances, and will add or remove as many layers of indirection as necessary, except where that would transfer ownership of something that is a part of something else, or which you only have a reference to (something you're "borrowing", as we call it in rust)
 
1 hour later…
23:52
I feel somewhat cheated by the rep recalculation bumping me to 10k without giving me the chance to earn it.

« first day (1856 days earlier)      last day (1853 days later) »