#rust-lang

/

      • monad joined the channel
      • monad has quit
      • cp- joined the channel
      • bronson joined the channel
      • Ixrec has quit
      • ubsan has quit
      • bronson has quit
      • ubsandroid joined the channel
      • ubsandroid3 has quit
      • jseyfried has quit
      • scottmcm
        wow, 95 hoorays on the NLL RFC already :)
      • aturon
        yeah it's gotta be a record
      • also the ratio of emojis to comments is pretty funny :)
      • woboats has quit
      • woboats joined the channel
      • eddyb
        Ralith: the syntaz we uss btw is match x { y: T => ..., z: U => ... } when discussing such features
      • type ascription *almost* made it into the language
      • Ralith
        yeah, that's the one I used
      • the absence of type ascription is weird
      • scottmcm
        I would love to see type ascription show up while deprecating `as`
      • eddyb
        scottmcm: I wanted to remove literal suffixes before 1.0
      • suffice to say I failed
      • bronson joined the channel
      • scottmcm: deprecating for coercions, right?
      • I do not want more than what let x: T = expr; does to happen for let x = expr: T;
      • scottmcm
        I would be fine with deprecating totally, assuming new functions like .wrapping_cast() and such
      • eddyb
        oh
      • I don't know how I feel about that
      • correct numerics code is unergonomic as it is
      • scottmcm
        I recall a comment that seemed reasonable about "it'd be odd to have two infix conversion operators"
      • bronson has quit
      • but just deprecating the ones that are implicit would also be a reasonable plan, and much less noisy
      • eddyb
        well, coercions are intentionally distinct from conversions but one might argue they shouldn't
      • Deref can be thought to "throw away information" just like a truncating cast so idk what makes me want to keep the distinction
      • scottmcm
        But I also come from the C++ "it's better to have really long conversion methods" camp
      • eddyb
        welp
      • scottmcm
        (for things that aren't reversible)
      • eddyb
        I still want a solution for complex number code
      • custom operators would please me
      • cbreeden
        Like a @ or #
      • eddyb
        I'd rather write +% than take a dozen characters
      • scottmcm
        there was that thread about allowing `a \dot b \dot c`
      • eddyb
        that is useless for me
      • cbreeden
        Matlab has a +.
      • eddyb
        it's the length of the method names
      • that is the problem
      • cbreeden
        But that might not work well with floating points
      • scottmcm
        eddyb: which ones? the checked_add and such?
      • eddyb
        they're usually far longer than variable names
      • scottmcm
        hmm, point
      • eddyb
        scottmcm: wrapping_add, saturating_add, overflowing_add are the ones I use
      • the first two should suck less to write
      • hardware not having saturating ops decades ago was a mistake
      • I made ugly C++ code with footgunish comparisons very clean Rust code by using saturating ops
      • actually
      • I want a projective integer type :(
      • scottmcm
        projective?
      • eddyb
        integers are already circular-ish
      • just make INT_MIN the point at infinity
      • cbreeden
        Kind of like a +/- Inf
      • eddyb
        yeah
      • now you have a symmetrical value range
      • *and* that infinity swallows things that would over/underflow
      • and keeps them in an easy to check location
      • cbreeden
        eddyb: that feels a lot like checked_add
      • scottmcm
        INT_MIN as NAN, with +/- INT_MAX as +/- INF?
      • eddyb
        cbreeden: no, saturating
      • but
      • cbreeden
        Where None is your projective inf
      • eddyb
        the problem with saturating ops is if you hit the cei
      • cbreeden: aaah sorry
      • you mean like Option<i32> + and_then composed with checked_add
      • scottmcm is sad that Option<T:Ord> is Ord, instead of just PartialOrd
      • scottmcm: why?!
      • scottmcm
        because which side the Nones go is so arbitrary
      • min and max have very different None behaviour
      • eddyb
        well
      • if you want min/max to ignore None I agree
      • scottmcm
        eddyb: at least Try will allow `catch { a.checked_add(b)?.checked_add(c)? }` to make part of the math problem better
      • eddyb
        heh
      • cbreeden
        +?
      • In before a? +? b? Is a valid expression
      • scottmcm
        I'm looking forward to const generics so that Integer<A,B>+Integer<C,D> -> Integer<A+C,B+D>
      • eddyb
        scottmcm: so NAN doesn't seem as useful as infinity to me
      • scottmcm
        eddyb: INF-INF, though
      • eddyb
        because only 0 / 0 is NAN with integers
      • ah that too
      • scottmcm: well NAN introduces more problems than it solves
      • just make the point at infinity handle the NAN case too aaand I just reinvented None
      • scottmcm
        I guess with circular you just define INF +/- INF as INF?
      • eddyb
        not sure
      • oh
      • wait hmmm
      • scottmcm
        a type that's like iN but reuses the MIN as a built-in None does sound interesting
      • eddyb
        scottmcm: anyway point at infinity is from unums 2.0
      • scottmcm
        since Option<iN> is so space-inefficient
      • eddyb
        if you're curious
      • scottmcm
        those are better than the very-debunked first ones
      • ?
      • aturon
      • eddyb
        just to be clear
      • you mean kahan by very debunked, right?
      • unums 3.0 are interestingly better but unums 2.0 are an insane deadend
      • est31
        aturon: where to post comments on your blog post?
      • not read it yet, but about to
      • aturon
      • est31
        thx!
      • aturon
        you bet
      • eddyb
        that someone might eventually put in silicon for its few redeeming properties
      • waaait a second
      • unums 2.0 can be convertible to unums 3.0
      • like, both formats could work in tandem
      • scottmcm: we should take this else though lol
      • scottmcm
        Well, I'm leaving to go eat in 7 minutes. But I'd be glad to continue it later :)
      • (here or elsewhere)
      • NLL up to 109 hoorays now :)
      • cbreeden
        * This RFC is way too long, I'll just leave an emote *
      • scottmcm
        I'm sure that's part of it
      • cbreeden
        aturon: ^ the secret to not get slammed with comments
      • scottmcm
        Though it was also blogged about and Pre-RFC'ed, so...
      • aturon
        cbreeden: lol
      • scottmcm
        lol @ "I’ve rarely hated anything as much as I hate the module system proposal"
      • aturon
        nrc: btw, the proposal in the post contains several improvements from our previous discussion, and in particular i realized that it *does* make some non-trivial simplifications of the privacy system
      • nrc opens tab with anticipation
      • nrc
        I've been shaking my fist at the privacy system a bit today when refactoring one of the RLS crates
      • aturon
        also it's quite a bit shorter than the last one :)
      • scottmcm
        minor point: killing `mod` makes it hard to demo privacy in playground examples.
      • (But something like "anonymous modules" -- maybe rebranded "explicit privacy fences" -- would be a totally reasonable thing to have anyway)
      • aturon
        scottmcm: inline mod is another question
      • nrc
        aw, I liked the `use ... from ...;` syntax more than `from ... use ...;` JS > Python :-)
      • aturon
        nrc: I'm ambivalent
      • nrc
        sorry, very bike-sheddy
      • scottmcm
        super-bikeshed: block indenting `from a use {b, c, d};` will look better than with use/from
      • cbreeden
        JS is most certainly not > Python :P
      • nrc
        aturon: can we deprecate `super` in use paths?
      • aturon
        nrc: not without replacement
      • nrc
        :-(
      • can't you always use an absolute path?
      • cbreeden
        I use super in my code and always feel a little guilty
      • aturon
        nrc: ah yes but I think we want some form of super
      • 'from .. use SomeType' maybe
      • vadimcn has quit
      • nrc
        I'd be interested to see where people actually use `super` in paths today - it seems a pretty stylistic choice
      • I imagine it is used more in crates with deep module hierarchies
      • I'm totally +1 on the `use` stuff
      • I would like to do something much more radical with privacy
      • sfackler
        nrc: "use super::*;" is great for test moduels
      • *modules
      • that's probably the only time I use super though
      • nrc
        oh yeah, true, I forgot about that