« first day (1833 days earlier)      last day (1648 days later) » 

1:35 AM
I have a friend who's doing a series on Youtube (Rust Up?) just thought I'd share it with the room because... topical. youtube.com/…
let me know what you think...
 
 
5 hours later…
6:49 AM
@AaronHall I haven't looked into any of the videos, but judging by the titles it looks like he's following The Book, which I think is a really, really good idea. I'll watch some later to form my opinion. Thanks for the share!
 
 
6 hours later…
12:35 PM
Good morning!
 
12:50 PM
'Morning!
 
Somebody working with Rust in the steel industry ? wooa
I thought I was the only one...
 
1:13 PM
Them: Does X in a question
Me: Do Y instead, it makes the question easier to answer
Them: I did X because I thought ... (does not do Y)
 
1:31 PM
I think half question are a xy problem
 
I don't even mean it that far
More like I say "please include your complete Cargo.toml" and they say "I didn't because I thought it wasn't needed"
like, I don't especially care why you didn't, just do it now
 
@Shepmaster true
 
2:15 PM
I must write some JS at work, and I wanted to give it a chance, but after a few days, I definitely think that it's shitty.
Just like C++ it has pile of legacy over legacy
I has a switch statement for example: what is it? C? Assembly? That's so ridiculous.
It doesn't even have a proper iterator construct with nice methods like in Rust
 
@FrenchBoiethios define "proper". There's a lot of stuff in libraries in JS too
 
There's map, filter, flatMap, and that's all. And for whatever reason they return another array
 
like lodash
That's common for languages where iterators aren't a foundational aspect.
Ruby has the same
lodash and Ruby both have ways of making it lazier though
 
@FrenchBoiethios it does no ?
 
That's funny. I've spent a few hours writing JS yesterday and I was surprised to find it an enjoyable and bug-free experience. It mostly depends on the codebase I think (it was on miaou)
 
2:19 PM
@Shepmaster I mean, when you get the children of an element, that returns a HTMLCollection. You cannot do shit with it.
 
no type no gain
 
@DenysSéguret And on your JS compilation and target environments.
 
@FrenchBoiethios if your project isn't of nanosize, you don't directly call DOM functions
 
@DenysSéguret I'm writing mine from start, and even if I cannot write some nice code. It looks like crap.
 
@Shepmaster yes
 
2:20 PM
@DenysSéguret really?
 
i.e. writing JS with very new ES standards aint bad.
 
@FrenchBoiethios go typescript
 
(or TypeScript)
 
also
enjoy, don't spit too much of your coffee on your monitor
 
@Shepmaster You still need a very consistent and smart enough set of conventions, a sane build/module system
 
2:22 PM
I mean, at a time T, there is no JS build alternative
at a time T+1 the standard may be completely different though
 
@SébastienRenauld I'm not sure if I can. The frontend dev/designer doesn't like it.
 
The luck I have in Miaou is I defined the module system long before the other ones. I keep it and it works well.
 
@DenysSéguret What do you mean?
 
I mean I made a small system to deal with client side modules and plugins so I don't have to deal with shits like webpack
 
@DenysSéguret I meant about the fact that you "don't directly call DOM functions"
 
2:26 PM
Well... either you make your own lib or framework, or you use something existing. It really depends on your use case
Even jQuery can avoid wasting time
 
Also, I think I'm a counterpart to others in the room — I've enjoyed using webpack and it's worked well for my cases.
 
@DenysSéguret My experience is like a week-old. I'm not sure that I could write a framework :P
 
@DenysSéguret consider asking whether you are not trying to reinvent the wheel
I can think of no case where you'd want to avoid webpack for modules
 
@SébastienRenauld Hu ? You mean by using a system I made a decade before webpack ?
 
and I can think of a ton of drawbacks of not using a tool like it to do so
does age mean anything? is your module system able to separate components and artefacts into different build files automatically, for instance?
 
2:30 PM
Remember, I'm not advocating for you to use it.
"does age mean anything". You say I "reinvent the wheel"... I invented it before
 
@FrenchBoiethios I think you should start with some framework and some build system. While browsers are better nowadays, there are still some differences (and sometimes bugs) that the frameworks deal with for you. The build system allows you to write code for very new ES style but transpile it to support older versions
 
@FrenchBoiethios do you have a backend ? what's your app ?
 
My personal choices are React + Webpack + Babel
 
Or just no transpiling if you only target new browsers, depends on the app
 
But there are alternate choices for each
 
2:35 PM
@DenysSéguret A web site in ASPNET Core
 
And how does it speak with the server ? graphql ? rest ?
 
I'm with @Shepmaster on this one but I sometimes swap webpack for rollup
 
@Shepmaster I'm not allowed to. The site size must be as small as possible
@DenysSéguret Nothing. I've only written forms for now, so I don't need anything special.
 
Ehm...
webpack has no impact on your bundle size?
or rather, it doesn't add anything other than polyfills, which you can define with presets
if you're after a lightweight alternative to react preact or svelte would be better
 
@FrenchBoiethios Will your site contain any images?
If so, how big are they?
 
2:42 PM
(or any other required media, such as webfonts etc)
 
Right. As a random sample from a blog post
Preact 6.2KB (min + gzip)
Svelte 4.8KB (min + gzip)
Even React is only ~100K
~35K gzipped
 
@Shepmaster thanks for the suggestion and edit also but isn’t collect do the same under the hood? Please take a look : doc.rust-lang.org/src/alloc/string.rs.html#1730-1745
 
@Shepmaster I think so, the big images of people smiling you see in the business sites.
 
@ÖmerErden It does, if size_hint works. That's why I said "if profiling"
@ÖmerErden although I don't think that's the right link
 
The site is while-label so it'll depend on the partner.
 
2:54 PM
@FrenchBoiethios heh while label {} ;-)
@ÖmerErden And that iterator says (0, None) for size_hint, so it might do multiple allocations
 
@Shepmaster sorry i am on mobile, yes that was the link
@Shepmaster checking
 
no worries or hurry
 
Oh i see
it allocates as lower boundary
So how did you find lower boundary as 0?
 
That behavior might have changed over time
call .size_hint() instead of .collect() and print it out
 
@Shepmaster white-label :P
 
3:04 PM
@FrenchBoiethios break 'rust
 
what code are you talking about ?
 
6
A: Most idiomatic way to double every character in a string in Rust

Ömer ErdenI would use std::iter::repeat to repeat every char value from the input. This creates an infinite iterator, but for your case we only need to iterate 2 times, so we can use take to limit our iterator, then flatten all the iterators that hold the doubled chars. use std::iter; fn main() { le...

I think it comes down to flat_map isn't able to implement a good size_hint since it doesn't know what might happen
 
@FrenchBoiethios whitelabelling is another reason to get a processor/bundler somewhere in the way
 
@Shepmaster Makes sense, thanks i’ll add this as an additional information to the answer whenever i can.
 
build a core CSS/JS offering, then expand based on the partner and let sass/babel do the work
 
3:07 PM
@Shepmaster yeah flat_map can't do that
 
@SébastienRenauld I'm always curious on good ways of making that kind of thing pluggable
 
I might land a project to do exactly this for a LoRa application
if I get it and I build it properly I'll share the final product with you
 
@SébastienRenauld huh, I struggle to make things with the DOM, so that's far beyond my capabilities
 
Independent skills @FrenchBoiethios
sass is basically a CSS preprocessor
it adds a whole bunch of things on top of CSS in addition to being able to make things modular and reusable
it's a really good habit to get into irrespective of your skill level at CSS or the DOM
 
There's no downside in using scss instead of CSS. Use it
 
3:09 PM
there is one
if you get too used to some of the directives used to mask an underlying quirk in browsers you tend to forget the quirks exist
 
Here I diverge — my recent CSS flavor of choice is cssnext.github.io + CSS modules.
 
But be careful that whatever the tool, skinning and branding, just like i18n, are a PITA to maintain
 
that, and there is no "right" way of doing so globally
there is on a project-by-project basis
 
In projects where I'm not using CSS modules, I highly recommend using BEM or some other namespace-y solution to avoid CSS conflicts
especially if you are whitelabel, you might want to prefix all of your styles with something to avoid conflicts with the end users
 
@Shepmaster That's indeed a nice idea
 
3:16 PM
And too many people forget that CSS is code too, must be maintained and kept clean. I've seen too many old projects where people couldn't tell why there was a specific rule. This is bad
 
Yup
Both to namespacing and sanity
do bear in mind that you can spec-test CSS
 
and modularization
 
most people don't know this
 
@SébastienRenauld what's that look like? I've seen some very brittle things people called "tests" for CSS, but I wasn't impressed
 
Is there a kinda monad notation in JS? I'm tired of doing: let foo = document.getElementById("foo"); if (foo != null) {...} I'd like to write document.getElementById("foo").do(elem => console.log("elem exists")).
 
3:18 PM
@Shepmaster quixote is an example of what it is
@FrenchBoiethios not in pure JS
You can build it yourself though
or get it from npm
 
The best would be an if let notation ;P
 
exists in typescript
and I'm pretty sure TS also has monads built in
 
@FrenchBoiethios not yet. a reason to have something like babel
 
@SébastienRenauld I just asked my manager why we cannot use it, he said that there would be still another language to learn/maintain.
 
@FrenchBoiethios you can do that today tho
 
3:21 PM
@Shepmaster Really?
 
@FrenchBoiethios he's not wrong
And yes
you can literally fill it in with babel
 
@FrenchBoiethios if (var foo = document.getElementById("foo")) { ... }
 
and then let babel do the work to bring it down to the browsers you're targetting
 
I swear there's a way to get that syntax... let me iterate
 
that's what you should be looking at if you want real algebraic structs in JS
 
3:23 PM
var fo; if ((fo = document.getElementById("sayit-button"))) { console.log(fo); }
 
@Shepmaster Is that really readable? :P
@SébastienRenauld Of course I do want it...
 
@SébastienRenauld designed by type theorists it seems... unfortunately
 
Yup
Still a step in the direction, though
there'll most likely be other projects to do parts of this
like, I found monad and functor so far
 
What about sum types and pattern matching?
 
3:27 PM
again, babel works for this
you can write in compliant-ES2019
and it'll backport it to JS that works on IE8
 
@SébastienRenauld My team won't like that. They don't even know what a sum type or FP are.
 
Have you tried gently educating them? Might work
 
If that's in the standard, they cannot yell at me for using it, but I cannot think that I can bring something like that from the outside.
 
I tend to find that most of these things get shot down by non-technical managers, not devs
it is in the standard from this year
it isn't in the standard from 9 years ago, which is what most people build for because fucking IE9
 
@SébastienRenauld I doubt of it. They don't really care
 
3:30 PM
Might want to try then; if they don't care enough to think of a reason against it, they might just try it
Also, shaky grounds anyway
for instance, github.com/tc39/proposal-flatMap is finished
as in, accepted and everything
 
@SébastienRenauld Ahah, I've used it literally 2 hours ago, without knowing that it's brand new
 
@SébastienRenauld it got accepted?
 
Pattern-matching? It's in the very late stages of stage 1
so it's basically virtually guaranteed to be accepted soon
 
4:07 PM
Oh my glob.
-1
Q: How to send bytes::bytes::Bytes by futures_core::stream::Stream?

Michał HanusekI'm trying write a TCP server based on Tokio's example. When I try to send the buffer, the compiler returns error 0277. My code: (playground) extern crate tokio; // 0.1.22 use tokio::codec::{BytesCodec, Decoder}; use tokio::net::TcpListener; use tokio::prelude::*; use bytes::Bytes; // 0.4.12...

We gotta close this one.
It's like pulling teeth
 
4:28 PM
not sure it's better XD
 
@Stargateur this for the "repeat characters" case?
 
yep
 
hmm (2, Some(6))
Which means it will allocate 2 bytes
 
shout be 3
 
it's unfortunate because with the conversion from UTF-8 to chars, you lose info
 
4:31 PM
actually not my fault
funny
 
e.g. "🥶" will be like 6 bytes, but 1 char
 
anyway string does not exist to be fast
 
375k rep. No MCVE. /me cries.
 
top tag, angular, typescript, dart, javascript
 
Which is all fine
But they have got to have experience with reducing problems to have that much rep
 
4:47 PM
@Stargateur "don't drop the temporary" How can I influence that? — Günter Zöchbauer 1 min ago
maybe a user who have sold its account on ebay
 
5:18 PM
@Stargateur wonder what the going rate is
 
 
3 hours later…
8:44 PM
Oh man
the php mailing list is embracing the go fast and break things mentality
[PHP-DEV] Reclassifying some PHP functions warning as exceptions
What could possibly go wrong
 

« first day (1833 days earlier)      last day (1648 days later) »