A struct is a data strucure, of course of course

BackerLeader 1 2 5
calendar_today agoschedule1 min read

When I started designing this language, I had a lot of fundamental decisions to make. Among those, one of the easiest was whether or not to allow virtual functions in scrml structs.

If I had chosen to include virtual functions; I would have just called these data strctures objects.

If you were paying attention, you might see why.

A struct is a data structure. Plain and simple. But, you see, it is within that simplicity, the power is made plain.

Lets define a unit of data as a value over over a type ( x/T ). Some would claim that it is state over type. Philistines!

State is data that is presently being witnessed.

While this might seem like a trivial distinction. The real differentiation comes from the realization that state is not witnessed in piecemeal. it is accepted as a whole, or thrown out as invalid state.

State is, therefore, immutable by nature.

So then, what of structs? I'll cover that in the next article "State. Why its not data."

Just kidding. I hope this next part is becoming more obvious.

So are struct mutable? ... Depends. But, let the default be: the node-tree structure should be immutable. Hence, a user definable structure. the values should mostly bi mutable, with each node mutation re-validated against it's type (or predicate if run-time validation is reqd)

Simple. And because it's simple, we can analyze it, exhaustively.

Enter enums, engine, and other super-powers that "objects" just can't match .)

Part 1 of 1 in Mindset
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

The End of Data Export: Why the Cloud is a Compliance Trap

Pocket Portfolio - Apr 6

I have a conffession to make

Bryan MacLeeverified - Aug 26
chevron_left
1.8k Points8 Badges
Vernal UTscrml.dev
4Posts
3Comments
2Connections
I am a truck drive specializing in the oil and gas industry, who happens to love coding.
i have been... Show more

Related Jobs

View all jobs →

Commenters (This Week)

6 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!