5 - Sets and Bags, and how NOT to use them [ID:12874]
50 von 549 angezeigt

Hello everybody, I'll do this in English because there's a number of people in here that basically

do not speak German well enough to actually understand this stuff.

So I'm sorry I'm going to do this in English this time.

So what?

Well, so why am I giving this presentation?

First of all I thought I'd give another presentation that is not as emotionally heavy as my previous

presentation.

So I thought I'd take a subject that is very boring and in a way close to my heart.

Because sets and bags basically unknown means unloved because many users don't really know

about sets and friends and they generally use just hashes.

They don't actually realize that sets and friends offer very handy functionality.

But even if people find out about sets and friends, the uses of them seems very artificial

like they don't actually know how to use it.

And so this is why I basically, people discover them and they use them like something that's

not completely integrated into the language.

And basically you should realize that sets and friends are fully integrated into the

language.

So they're actually part of the basic language.

So use them.

One of the reasons that you want to use them is because they allow for a much more descriptive

programming.

So let's start the journey.

Everything in Raku is an object.

Even the classes are objects and the classes that describe the class, well okay, it stops

somewhere but basically in general everything is an object in Raku.

But what is an object anyway?

How can I create an object and how can I create an object of a new type?

It's all basically a matter of class.

And so we come to the thing is what is a class?

Well Wikipedia actually has a description for that.

In object oriented programming a class is an extensible program code template for creating

objects providing initial values for state attributes and implementations of behavior

methods.

I've taken the liberty of actually introducing, oops wrong button, of removing the stuff that

is in Wikipedia that's not entirely appropriate for our situation.

In Raku the class name is used as the name of the class, the template itself.

New is to default the structure of the class which is a method that creates objects.

So with only minor changes from Wikipedia I think we are pretty standard stuff going

on here, generally accepted in computer science.

So what does a class look like in Raku?

Voila, a class.

It consists of a class keyword.

It consists of a name and it exists of a scope in which stuff happens.

Voila, there's your class.

So what is an object?

Well Wikipedia to the help again.

When an object is created by a constructor of the class the resulting object is called

an instance of the class and the member variables specified to the object are called attributes

in Raku.

Instance variables, we call them attributes.

Teil einer Videoserie :

Presenters

Elizabeth Mattjisen Elizabeth Mattjisen

Zugänglich über

Offener Zugang

Dauer

00:49:53 Min

Aufnahmedatum

2020-03-04

Hochgeladen am

2020-03-04 21:10:22

Sprache

en-US

Sets and Bags are useful data types for many applications. But people find them cumbersome to use. They shouldn't, because in many cases you can use the semantics associated with Sets and Bags without having to use those words (much).

Tags

Kongress point perl class object objects method type adapted raku self protect valuetypecache prefix
Einbetten
Wordpress FAU Plugin
iFrame
Teilen