Comments (6)
Hmm, I was thinking about inheritance - child elements inheriting their position from the parent, resulting in layouts and things - but that wouldn't make much sense with that kind of function syntax, but tbh idk how that inheritance idea could work anyway.
from vidseq.
Could object-defaulting and inheritance have different syntaxes? Maybe something more programmatic for inheritance, like:
let container = Box { x: 0, y: 0, w: 320, h: 180 };
let title = Text { parent: container, dy: 160 };
Not sure about the parent
property, but something along those lines. Maybe with @
?
let container = Box { x: 0, y: 0, w: 320, h: 180 };
let title = Text { dy: 160 } @ container;
Not sure... Someone might think that there's a variable called @
that you're combining with the object...
from vidseq.
Perhaps an element can be declared as a child of another element? I'm not using the colon yet, so maybe something like this?
let container = Box { x: 1, y: 3 };
let child = container: Image { x: 2, y: 4 };
Idk, the colon is kinda already used for the json object syntax, and at the same time it doesn't really show that the two are linked together. I wish there was an ascii character that's easily typable that looks like a link
from vidseq.
What about a tilde? ~
it sorts looks like a link...
let container = Box { x: 1, y: 3 };
let child = container ~ Image { x: 2, y: 4 };
Not sure actually, it could be mistaken for a -
from vidseq.
I don't really want to have to add a children
key to every object, I just want to be able to get the value of another element's value, but this is what a children
key could look like anyway:
let child = Image { x: 2, y: 4 };
let container = Box { x: 1, y: 3, children: [ child ] };
Ooohh no I don't like having to declare the child before the parent. That's like declaring a class that inherits from a class you haven't declared yet.
from vidseq.
Okay. Revisiting this 2 years later - could use something like signals. They gained a bit of traction last year, and it could work. Maybe it'd work like this?
let parent = Box { x: 1, y: 3 };
let child = Box { x: parent.x + 2, y: parent.y + 4 };
That implies that you get the value of the parent box, but at the same time people might think it doesn't update, because that's just what happens in JavaScript. It could use another piece of syntax, like an @
or ~
or something.
Or it could just break the mold of JavaScript land and be free to spread it's wings. 🪽🪽
from vidseq.
Related Issues (6)
- Objects and transitions HOT 2
- Transition syntax HOT 4
- Events and Boolean operations HOT 2
- Built-in Variables HOT 2
- Importing and using files for structure HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vidseq.