Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
Rusky
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
57 ms
·
601.
▲
by
Rusky
8y ago
Try the newest version of those docs: https://docs.microsoft.com/en-us/cpp/build/reference/std-spe...
602.
▲
by
Rusky
8y ago
> I find it strange that this design forces you to use a single exception type, std::error, for everything you want to throw with the new mechanism. I actually kind of like the idea. It ensures that error returns will be a fixed, small s
603.
▲
by
Rusky
8y ago
The match changes here don't bother me anywhere near as much as deref coercions do, because they preserve the level of indirection. Deref coercion makes a &Box<T> behave like a &T (removing a level of indirection). Defa
604.
▲
by
Rusky
8y ago
That would still require dynamic dispatch of some kind.
605.
▲
by
Rusky
9y ago
You can't get rid of GC in Java without essentially replacing Java.
606.
▲
by
Rusky
9y ago
Yes, I do want a JIT in that sense. I just don't want it doing Javascript-style optimizations with profiling and speculation+deoptimization. What WebKit is doing is moving in that direction (unfortunately) but it still looks much more
607.
▲
by
Rusky
9y ago
> It seems only logical that wasm interpreters will be optimizing JITs. Webassembly was designed not to do this, and I really hope it stays that way forever. Optimizing JITs are useful for highly dynamic languages like Javascript; Weba
608.
▲
by
Rusky
9y ago
> It's a matter of whether the children are resolved before the parents, or the parents are resolved before the children. Yep, and Narcissus resolves the parents before the children by virtue of `Script` calling `Statements`, `State
609.
▲
by
Rusky
9y ago
The idea that it's left-recursive is not changed by the existence of top-down operator precedence, or kleene stars, or right recursion. And it's not a weakness, either- just one way to think about the problem which happens to map
610.
▲
by
Rusky
9y ago
That definitely looks like normal recursive descent- it has functions `Script`, `Statements`, `Statement`, `FunctionDefinition`, `Expression`, etc.
611.
▲
by
Rusky
9y ago
Yeah, I agree. When writing this I spent a lot of time keeping track of LR states to decide how to split things up into functions, but in a recursive descent parser that's already decided by the grammar. I can see myself using it for e
612.
▲
Writing a recursive ascent parser by hand
(abubalay.com)
140 points
by
Rusky
9y ago
|
42 comments
613.
▲
by
Rusky
9y ago
There's also UFCS: for (a, b) in Iterator::zip(as, bs) { // ... }
614.
▲
by
Rusky
9y ago
I treat the parentheses the same way I treat the braces: void MyLongMethodName( SomeLongParamType param1, SomeOtherLongParamType param2, YetAnotherLongParamType param3 ) { if ( longContr
615.
▲
by
Rusky
9y ago
To provide stronger types in some cases? To opt into in performance-sensitive programs? To see if it can be made less burdensome if different tradeoffs are made?
616.
▲
by
Rusky
9y ago
> he'd also introduced us to every bit of syntax we would learn in the course. This doesn't seem like a very meaningful distinction to me. Lisp may not have a lot of syntax, but it still has a comparable number of features to o
617.
▲
by
Rusky
9y ago
I'm a fan of effects, and I think they would work great for Rust. (I/O just probably wouldn't be one of them, or else it would be "on by default" like `Sized`.) I'm not sure how they'd give you a unified m
618.
▲
by
Rusky
9y ago
That... does seem to be the goal.
619.
▲
by
Rusky
9y ago
I'm... not sure what you're getting at here. Rust is chock-full of "monadic concepts" like that, including the entire sets of `Iterator` and `Future` combinators. (Note that even without do-notation these have the compos
620.
▲
by
Rusky
9y ago
You're right; I kind of left that out since it's not (currently) possible to have a bare `str` anyway and there are more ways to work with one than just `&str` (`Cow<str>`, `Box<str>`, `Rc<str>`, etc).
621.
▲
by
Rusky
9y ago
> (granted, there is some ground to be covered before such an abstraction would fit in Rust) I would claim that such an abstraction is fundamentally incompatible with Rust. Not only does Rust lack the means to write a Monad trait on whic
622.
▲
by
Rusky
9y ago
> Heap allocated vs. stack/statically allocated. `str` is very rarely stack allocated, and often points into a heap-allocated `String`. Further, there's an optimization on the table that will let `String`s point to static alloc
623.
▲
by
Rusky
9y ago
It's a systems language. C++ offers the same choices- std::string, std::string_view/char*, etc. Higher level languages can get away with simplifying this stuff; systems languages can't.
624.
▲
by
Rusky
9y ago
> I read the paper's description, and still don't quite understand exactly what they mean by "memory safety". This is not referring to safer programming practices like using the STL with iterators, correct? I would as
625.
▲
by
Rusky
9y ago
That is precisely correct. It also works before the variable has even been initialized to begin with: https://play.rust-lang.org/?gist=faf1642e4e1f48decbeac704505...
626.
▲
by
Rusky
9y ago
IMO the builtin version is much nicer than the equivalent Haskell, and thinking in terms of composing continuations rather than composing monads makes more sense for imperative languages.
627.
▲
by
Rusky
9y ago
The reason async/await is implemented as a language extension in JS/C#/Kotlin/etc. is not because they're not powerful enough for a promise library, but because the language extension version composes with imperativ
628.
▲
by
Rusky
9y ago
The fundamental problem here is that C compilers just don't have enough information about your code. An "unsafe pattern" that might warrant a warning in one place may be crucial in another. Rust's innovation here is that
629.
▲
by
Rusky
9y ago
> call duplicate conflicting versions of the same library where it is needed in your code Cargo already does this automatically if two of your dependencies depend on conflicting versions of the same library. And for what it's worth,
630.
▲
by
Rusky
9y ago
For what it's worth, you can still compile your code to panic on overflow in release builds today if that's worth it for your use case.
More ›