63 karma · joined Aug 9, 2023 (3y ago) · 37 submissions
comment 8mo ago · link · parent
Swift is a nice language, and it's new support for the bare necessity of affine types is a good step forward, but it's not at all comparable with Rust.
comment 1y ago · link · parent
[1]: https://doc.rust-lang.org/reference/statements.html
[2]: https://play.rust-lang.org/?version=stable&mode=debug&editio...
comment 1y ago · link · parent
pub fn play<lifetime p>(in out self, player: mut ref AnimationPlayer lifetime p, new_animation: AnimationNodeIndex, transition_duration: Duration) -> mut ref AnimationPlayer lifetime p
But, this is still confusing! Let's remove even more symbols, and make the syntax more obvious by removing abbreviations: PUBLIC FUNCTION Play
LIFETIMES
P
PARAMETERS
IN OUT Self
Player AS MUTABLE REFERENCE TO AnimationPlayer WITH LIFETIME P
NewAnimation AS AnimationNodeIndex
TransititionDuration AS Duration
RETURNS MUTABLE REFERENCE TO ActiveAnimation
BEGIN
...
END
IMO, using keywords instead of symbols for references, lifetimes, etc, would just make Rust overly verbose, and there's a reason BCPL used braces instead of BEGIN/END :^)comment 1y ago · link · parent
[1]: https://homepages.inf.ed.ac.uk/wadler/papers/papers-we-love/... (can be spotted on page 353)
18.
Sony Proposes Changing LLVM Clang Default to C++20 Mode(phoronix.com ↗)
13 points · by needlesslygrim · 1y ago · discuss
comment 1y ago · link · parent
True, but to make use of Rc/Arc in Rust comparable to the use of GC in Java, almost evrery value would have to be wrapped in one, something I would think is quite rare.
> only that most programs do use it
I would still be interested in seeing statistics for this though. I have only ever used Arc once, and it was only to share a Mutex containing the program's database across threads.
> What's the difference between a standard library and a runtime?
I would say there are three main differences: - A runtime is (usually?) not optional - see languages like C#/Java/Python that require some sort of higher 'power' to manage their execution (interpreting/JITing code, GC management, etc), or crt0 - compared to a standard library which is just some extra code - see the C standard library function strlen() - A standard library can generally be implemented in the language itself. I think this is where the distinction starts to get a little fuzzier, with languages like Roc (its standard library is implemented in Zig), and Haskell (I would assume much of the side-effecty code like the implementation of IO is in C) - The purpose of a standard library is generally to provide 'helper' code that you wouldn't want to write yourself, e.g. Vec<T>, HashMap<T>, filesystem functions, etc. On the other hand, the purpose of a runtime is, per the first point, to manage the execution of the language, etc.
> I never said that LLVM was a JVM
True again, my point was worded badly. I didn't mean to suggest you thought LLVM was a JVM, rather to draw a distinction between LLVM and a Java/.NET style VM. LLVM used to stand for Low Level Virtual Machine, and the JVM has instructions like instanceof (which, fairly obviously, checks if a reference is an instance of the named class, array, or interface type). They operate at quite different abstraction levels, and the JVM is a lot more similar to the CLR.
> Now, it is true that Rust is typically (though not always) compiled to native code AOT
I would be genuinely interested in finding about a JIT compiler for Rust.
EDIT: it's worth me mentioning none of this is backed by any formal education (I'm 18), so it is very possibly wrong.
comment 1y ago · link · parent
comment 2y ago · link · parent
type 'a t = 'a option =
| None
| Some of 'a
I think this is the case because IIRC this function: fn slice<'a>(s: &'a str) -> &'a str { &s[0..2] }
Is generic over the lifetime of `s`, and it I assume it would have been difficult to distinguish generic types and lifetimes.28.
Build better apps faster with Jetpack Compose(developer.android.com ↗)
1 points · by needlesslygrim · 2y ago · discuss
comment 2y ago · link · parent