[-] [email protected] 7 points 5 hours ago

Well there's also their adventure of deciding whether they want to stay on the fediverse or do their own thing. I haven't seen anything on that from them recently, but last I saw (early this year) was that they were certainly thinking about leaving.

[-] [email protected] 6 points 8 hours ago

Do you happen to know what platform compatibility they're aiming for (I haven't picked up on that) ... a "plain" mastodon & user-actor or anything involving more that could be compatible with groups / threadiverse?

8
submitted 9 hours ago* (last edited 9 hours ago) by [email protected] to c/[email protected]

The about section of the linked page has links and a brief explanation of the story.

In my own words ...

Description of the Turbo-fish syntax

  • Whenever a generic type (see ch 10 of The Book) is involved in calling a function/method or constructing/handling a struct/enum, you may need to specify that concrete type for that generic.
  • This type is provided with the turbo fish syntax: ::<> ... where the type goes between the angle brackets.
  • EG:
let v = Vec::new();

let v2 = Vec::<i32>::new()
  • The elements of v have an undefined type, which rust will infer once an element is pushed into it. But v2 has a defined element type, i32, defined using the turbo fish.

The Story

  • This syntax wasn't always liked, and the double colons (::) thought redundant.
  • But it stuck
  • And was given the name "turbo-fish" by Anna Harren (u/deadstone, Reddit) ... who sadly passed away in 2021.
  • It turns out that the double colons are pretty vital to preventing ambiguity.
  • This is enshrined in the Bastion of the Turbofish which stands as a memorial to Anna Harren ...
  • a test in the language's test suite that ensures that the double-colons syntax isn't removed by directly using the ambiguous syntax that'd arise without it.
  • See if you can understand the test (it took me a while! ... this HN post might help):
let (the, guardian, stands, resolute) = ("the", "Turbofish", "remains", "undefeated");
let _: (bool, bool) = (the<guardian, stands>(resolute));

hint: what are angle brackets normally used for and how are bool types related to that?

[-] [email protected] 5 points 10 hours ago* (last edited 6 hours ago)

I can understand that. Really don’t want to ~~stack~~ attack you personally or anything. It’s part of why I describe it as a cultural thing that’s ~~give~~ gone to far. If everyone is talking about it, it’s on our minds as it was on mine. My ability to ignore may be significantly attributable to not great eyesight (even with glasses, there’s something that’s lost from your peripheral vision IME).

[-] [email protected] 10 points 15 hours ago

One thing I haven’t seen mentioned enough is how well it will work with Fury Road for first time viewers.

Think of Fury Road as the sequel and this becomes an awesome pair of films.

The Furiosa plot through the films is great and the elevation of the action and its stakes in Fury Road after the plot foundations in Furiosa make for a brilliant “sequel”.

[-] [email protected] 12 points 15 hours ago

Funny. I watched it just recently. I noticed something a bit CGi very early on, realised that that whole thing would be a distraction and turned that off in my brain … didn’t notice a thing afterwards and didn’t care … the film looked great.

I keep saying it … this practical v CGI thing has gone too far.

[-] [email protected] 2 points 2 days ago* (last edited 2 days ago)

So, genuine question ... who's willing to predict whether Biden will go to the election or not?

I'm a not a USian or plugged in that much, but this topic feels strangely fractured. Anyone with some certainties they're willing to put online?

Edit: not a USian.

[-] [email protected] 4 points 2 days ago* (last edited 1 day ago)

I don't think this is correct.

The bit you're getting confused by, I think, is that some generations are just bigger than others. The boomers were by their name sake a big generation. Millennials are essentially boomers' kids ... and so they’re bigger than both Gen X and Gen Z.

  • Most "generational" definitions span about 15 years, sometimes more. EG, Boomers: 1946-1960
  • There are sensibly defined micro-generations typically at the borders between generations.
    • EG, "Jones Generation": 1960-1965 ... "young boomers" ... they had a distinct life experience from "core boomers" not too different from that of X-Gens. Vietnam and 60s happened while they were children, Reagan was their 20s, not 40s, etc.
  • Xennials are notable here because they're the transition between X-Gen and Millennials (late 70s to early 80s) ... probably what you're thinking of as "older millennials". What's interesting though is that the relevance of Xennials is that technological changes mark the generation ... they're essentially just barely young enough to count as part of the internet generations but not ~~old~~ young enough to be ignorant of the pre-internet times. Which just highlights that how you talk about generations depends on what you more broadly care about. In the west, arguably not too much political upheaval has occurred since WWII and its immediate consequences (basically Boomer things) ... and so the generations are distinguished on smaller and probably more technological scales.
[-] [email protected] 3 points 2 days ago

Ok ... yea I don't recall exactly when, but I recall noticing it when it first came out. It's not that old though ... the design of the maps used to really bad at separating out different lines.

[-] [email protected] 3 points 2 days ago

Yep. I’d forgotten when it happened. 2017 makes sense. I also don’t recall when this design happened … I’m thinking around 2015 or so.

[-] [email protected] 3 points 2 days ago

Well it’s got the new design, so it’s not that old. But the 8 and 55 are still there so it predates that “merger”. Can’t recall when it happened, but pre-pandemic is my rough memory, so I’d guess 2015-2019.

[-] [email protected] 7 points 3 days ago

Maybe a good candidate for Fedi Film Club?

I’ve never seen it!

6
submitted 4 days ago by [email protected] to c/[email protected]

Nice and handy reference with explanations and examples.

[-] [email protected] 15 points 4 days ago

It was a crisis the moment that the Journal system was allowed to be built without any oversight from academia or the government itself.

A whole class of intelligent professionals performing a public good on public funds were tricked into doing most of the work for profitable companies who then charged these same people to read their peers' work. They were tricked by appealing to their ego and longing for prestige.

And so now we have incessant publication/citation metrics and a tsunami of untrustworthy papers while shitty corporations rob the public funds of money that could much better spent.

Once that system was built, it was a crisis. Not just because it exists (and naturally leads to the current situation and worse). But because it was allowed to come into existence, which speaks to an intrinsic inability to self-govern on the part of the academic community.

5
submitted 5 days ago* (last edited 5 days ago) by [email protected] to c/[email protected]

You've gotta be familiar with Traits to try to work this out.

Just in case you want to try to work it out your self firstGotta say, after hearing that rust is not an OOP/Class-inheritance language, and is strongly and explicitly typed, the Deref trait feels like a helluva drug!

Obviously it's not the same thing, but working this out definitely had me making a couple of double takes.

Somewhat awkwardly, I worked it out through the standard lib docs before reading ch 15 of the book (it's more fun this way!).

And for those who want a quick answer:

  • Read the Deref docs, especially the deref coercion part
  • This allows a variable of a particular type to be implicitly substituted with another variable of a different type.
  • It happens any time a reference is passed in/out of a function, including self in method calls.
    • And obviously requires that Deref be implemented.
  • So sort() isn't implemented on Vec, it's implemented on the slice type ([T]).
  • But Vec implements Deref, substituting [T] for Vec<T> in all function/method calls.
  • Which means Vec gets all of the methods implemented on [T] ... almost like Vec is a subclass of [T]!
  • And yea, OOP people want to abuse this (see, eg, rust-unofficial on anti-patterns)
27
submitted 6 days ago by [email protected] to c/[email protected]

Please suggest a film for July's "Fedi Film Club"!

Anything that either you'd like to watch or would recommend to the community.

Please make sure it's more than a year or two old so that it will (hopefully) be available somewhere.

And if possible, provide a quick description for why you'd like to watch or why you suggest it.


69
submitted 6 days ago by [email protected] to c/[email protected]

I watched them roughly once every night or two. And I'd previously seen them all.

And I was rather surprised at how I felt about the films afterwards. It seemed really clear that the quality of the films went continuously down after Casino Royal.

I thought Skyfall would stand out as the best followed by Casino Royal. But, in sequence, nah. Despite having clearly positive qualities, it seemed bloated and empty by comparison.

I also thought Quantum of Solace would rank pretty low as I recall thinking little of it at the time it came out. Instead, I thought it paired really well with Casino as a great follow up.

In fact, it felt like the Craig-era was basically Casino + Quantum and "other things". And yea, the "post-Skyfall" films just didn't feel like they were worth the effort. I thought they'd be more passable than they were, but after Casino + Quantum, which, for me, had a real punch and through-line, Spectre + No-Time-to-Die just felt like they were going through the motions and taking up space. At times, they really seemed to be badly flawed. And that's where my impression of Skyfall really hit ... it seemed that was the "what do we do now with this character?" moment and that Skyfall belonged with Spectre etc not the other way round.

Is this common among Bond fans or am I off base here?

22
submitted 1 week ago by [email protected] to c/[email protected]

About 10 mins. Focuses on some of the shooting and camera choices in Alien.

Specifically how "dirty shots" were used ("dirty" meaning some unfocused object "dirties" up the shot) and how the 2 camera setup were used.

I think the video was trying to make a point about how Alien was kinda "modern" in this regard. I don't know cinema theory well enough to know ... definitely interesting though!

Either way ... it's some Alien appreciation and this little snippets are definitely good reminders of how awesome the film is.

4
submitted 1 week ago by [email protected] to c/[email protected]

Continuing on from Chs 5 & 6 of "The Book" (see "Reading Club" post here), I don't think the Copy and Clone traits were quite given sufficient coverage.

So I thought I'd post my understanding here.

Tl;Dr

Copy Clone
Implicit Explicit (v.clone())
Simple (memcpy) Arbitrary
"cheap"/quick Potentially expensive
Simple types Any type

Derivable Traits

  • These are traits which have a standard implementation that can be freely and easily applied to structs and enums (IE, custom types).
  • The ones available in the standard library are listed in Appendix C of The Book. Other libraries/crates can apparently implement them too (though I don't know of any).
  • They are part of and use the Attributes syntax (see Documentation in the Rust Reference here): #[ATTRIBUTE].
  • To derive a trait we write #[derive(TRAIT1, TRAIT2, ...)] above our type declaration
#[derive(Copy, Clone)]
struct Copyable {
    field: i32,
}

#[derive(Clone)]
struct OnlyClonable {
    field: i32,
}

The Three Step Ladder

  • The two traits, Clone and Copy, are about providing opt-in options for custom types around what "ownership semantics" they obey.
  • "move semantics": are what we know for most types and have learnt about in ch 4. There is no copying, only the moving of ownership from one stack to another or the use of references and the "borrow checker" that verifies safety.
  • "Copy semantics": are what basic types like i32 enjoy. No ownership movements. Instead, these variables get implicitly copied, because they're simple and copying involves the same work involved in passing a memory address around.

The RFC for these traits puts it nicely ...

From RFC 0019 - Opt in built-in traits document on the Copy Trait

Effectively, there is a three step ladder for types:

  • If you do nothing, your type is linear, meaning that it moves from place to place and can never be copied in any way. (We need a better name for that.)
  • If you implement Clone, your type is cloneable, meaning that it moves from place to place, but it can be explicitly cloned. This is suitable for cases where copying is expensive.
  • If you implement Copy, your type is copyable, meaning that it is just copied by default without the need for an explicit clone. This is suitable for small bits of data like ints or points.

What is nice about this change is that when a type is defined, the user makes an explicit choice between these three options.

IE, "move semantics" are the default, "copy semantics" can be adopted, or clone for the more complicated data types or for where it is desired for duplication to be explicit.

  • Note that Clone is a supertrait of Copy, meaning that we have to derive Clone if we want to derive Copy, but can derive Clone on its own.
struct Movable {
	field: i32
}

#[derive(Clone)]
struct OnlyClonable {
    field: i32,
}

#[derive(Copy, Clone)]
struct Copyable {
    field: i32,
}

Example

Demonstrate how a struct with Copy obeys "copy semantics" and gets copied implicitly instead of "moved"

  • Declare structs, with derived traits, and define a basic function for taking ownership
fn check_if_copied<T: Clone>(x: T) -> T {
    println!("address: {:p} (from inner owning function)", &x);

    x
}

#[derive(Clone)]
struct OnlyClonable {
    field: i32,
}

#[derive(Copy, Clone)]
struct Copyable {
    field: i32,
}
  • Instantiate variables of both structs, cl that has Clone and cp that has Copy.
  • cl is moved into check_if_copied and so is no longer live or usable afterward.
  • cp is not moved into check_if_copied and lives beyond the call of check_if_copied.
let cl = OnlyClonable{field: 0};
let cp = Copyable{field: 1};


// OnlyClonable type obeys "move semantics"

check_if_copied(cl);  // cl gets moved in as it's not copyable

// COMPILER ERROR.  Can't do this! As moved into `report_if_copied`!
println!("address: {:p}", &cl);

// Copyable obeys "copy semantics"

check_if_copied(cp);  // cp is implicitly copied here!

// Can! as not moved but copied
println!("address: {:p}", &cp);

Demonstrate the same but with mutation

let mut mcp = Copyable{field: 1};

let mcp2 = check_if_copied(mcp);  // as mcp was implicitly copied, mcp2 is a new object
mcp.field += 100;

// values will be different, one was mutated and has kept the data from before the mutation
println!("mcp field: {}", mcp.field);
println!("mcp2 field: {}", mcp2.field);

prints ...

mcp field: 101
mcp2 field: 1

Application and Limitations

Copy

  • Copy is available only on types whose elements also have Copy.
  • Such elements then need to be the numeric types (i32, f64 etc), bool and char. So custom types that contain only basic data types.
#[derive(Copy, Clone)]
struct Copyable {
    field: i32,
}
  • Any field with a non-copyable type such as String or Vec cannot be made Copyable
// Copy cannot be derived as `f2: String` does not implement Copy
#[derive(Copy, Clone)]
struct NotCopyable2 {
    field: i32,
    f2: String
}
  • But custom types that have the Copy trait as fields work fine, like Copyable from above as a field:
#[derive(Copy, Clone)]
struct Copyable2 {
    field: i32,
    more: Copyable
}
  • Beyond this, Copy is not overloadable and can't be implemented in rust (without using unsafe presumably). It's really just a primitive of the language it seems (see source code for the Copy trait).

Clone

  • Like Copy, Clone relies on the struct's fields also implementing Clone.
  • A number of standard library types have implemented Clone (see list of implementors in the documentation), including the fundamental collections you'll find in chapter 8 of The Book: String, Vec, HashMaps and also arrays.
  • Thus the code below, which involves a more complex Struct with fields that are a String, array and Vec, compiles just fine.
  • With the clone() method, Clonable is now able to be duplicated allowing the original to be usable after being passed in to check_if_copied().
#[derive(Clone)]
struct Clonable {
    name: String,
    values: [f64; 3],
    data: Vec<i32>
}

let clonable = Clonable{
    name: "Sam".to_string(),
    values: [1.0, 2.0, 3.0],
    data: vec![111, 222]
};

// clonable is duplicated with the `.clone()` method
check_if_copied(clonable.clone());

// original still usable as it was never moved
println!("Name; {}", clonable.name);
  • But, unlike Copy, is overloadable, which means you can implemented Clone for your custom types however you want if necessary.
  • This would be jumping ahead a bit to Traits, but we could implement Clone for our struct above ourselves with something like the below:
struct Clonable {
    name: String,
    values: [f64; 3],
    data: Vec<i32>
}

// Just use each field's `.clone()` implementation, much like the default would do
impl Clone for Clonable {
    fn clone(&self) -> Self {
        Self {
            name: self.name.clone(),
            values: self.values.clone(),
            data: self.data.clone()
        }
    }
}
  • Or we could see how Clone is implemented for Option:
impl<T> Clone for Option<T>
where
    T: Clone,
{
    fn clone(&self) -> Self {
        match self {
            Some(x) => Some(x.clone()),
            None => None,
        }
    }
}
  • Basically relies on the implementation of Clone for the inner value inside Some. Note the where clause that limits this to Option variables that contain values that have the Clone trait.

Deep or Shallow Duplication

  • In the case of Copy, duplication should always be "deep".
    • Which isn't saying much due to the simplicity of the types that can implement Copy.
  • In the case of Clone ... it depends!
    • As the implementations of Clone on the fields of a custom struct/enum are relied on, whether the duplication is deep or shallow depends entirely on those implementations.
    • As stated in the RFC quoted above, Clone is for complex data structures whose duplication is not trivial such that compromises around performance and duplication depth may need to be made.
    • A clue can be discerned from the signature of the implementation. For Option, above, the inner value was restricted to also having implemented Clone, as the value's .clone() method was relied on. Therefore, Option's is deep.
    • Similarly, the Clone implementation for Vec has the same restriction on its elements: impl<T, A> Clone for Vec<T, A> where T: Clone, (see source code), indicating that its implementation is at least one level deep.

Overall, this seemed a fundamental part of the language, and I found it weird that The Book didn't address it more specifically. There's nothing really surprising or difficult here, but the relative roles of Clone and Copy, or the "three step ladder" are important to appreciate I think.

16
submitted 1 week ago by [email protected] to c/[email protected]

Relevant for @[email protected] 's next stream next week as they're hitting smart pointers.

cross-posted from: https://programming.dev/post/16059115

Found this on Mastodon https://fosstodon.org/@dpom/112681955888465502 , and it is a very nice overview of the containers and their layout.

73
submitted 1 week ago by [email protected] to c/[email protected]

The Idea

  • Watch and discuss movies together (kinda like a book club)
  • "Crowd source" recommendations for not-entirely-new films (IE, older than a year or so, let's say)
  • Aim for generally bettering or curating our film "diet"

How it will work (at least at first)

  • 1 film a month
  • First, a post to take nominations/suggestions
    • Post any film you want to watch, or have heard good things about, or recommend to everyone else
  • Second, a post to take votes on the nominations
  • And then we watch and discuss the winner

First round will start next month (July)

Please share any thoughts/feedback, though we'll likely run this at least once first before making any changes, just to feel it out

61
submitted 1 week ago by [email protected] to c/[email protected]

Not the prettiest graph, but a neat way of putting all this information into one image.

Wiki Commons page: https://commons.m.wikimedia.org/wiki/File:Generation_timeline.svg#mw-jump-to-license

Wikipedia page on Generations: https://en.wikipedia.org/wiki/Generation

70
submitted 1 week ago* (last edited 1 week ago) by [email protected] to c/[email protected]

Edit: Here's the exact same clip on the standard YouTube Watch page.

courtesy of zagorath


Brandon Sanderson the fantasy author

For those uninterested in watching a youtube short (sorry), the theory is pretty simple:

COVID and the death of theatres broke the film industry's controlled, simple and effective marketing pipeline (watch movie in theatres -> watch trailer before hand -> watch that tailer's movie in theatres ...) and so now films have the same problems books have always had which is that of finding a way to break through in a saturated market, grab people's attention and find an audience. Not being experienced with this, the film industry is floundering.

In just this clip he doesn't mention streaming and TV (perhaps he does in the full podcast), but that basically contributes to the same dynamic of saturation and noise.

Do note that Sanderson openly admits its a mostly unfounded theory.

For me personally, I'm not sure how effective the theatrical trailers have been in governing my movie watching choices for a long time. Certainly there was a time that they did. But since trailers went online (anyone remember Apple Trailers!?) it's been through YouTube and online spaces like this.

Perhaps that's relatively uncommon? Or perhaps COVID was just the straw that broke the camel's back? Or maybe there's a generational factor where now, compared to 10 years ago, the post X-Gen and "more online" demographic is relatively decisive of TV/Film sales?

13
submitted 1 week ago by [email protected] to c/[email protected]
view more: next ›

maegul

joined 1 year ago
MODERATOR OF