Standard Language Specification (abridged) #17
Replies: 7 comments 1 reply
-
This looks great. I don't have an issue with any of the more advanced functions. |
Beta Was this translation helpful? Give feedback.
-
What are your opinions on static-typing? A lot of my programming experience has been in Java and C/C++. I’ve been using Python and JavaScript only in the recent few years. There are things I appreciate - simple implementation of things like dynamic lists (vectors), dictionaries (maps), dynamic return types. But, I’ve been finding these same features very inconsistent lately. This is the reason I prefer TypeScript, and use type hints in Python as much as possible. |
Beta Was this translation helpful? Give feedback.
-
If we use Python, we can use Pydantic to define (and check) schemas. It works very well and leads to more consistent code. |
Beta Was this translation helpful? Give feedback.
-
I understand that. I meant the type-constraint in Music Blocks itself. I guess the language specification is independent of the language it is implemented in. e.g. What do you think about static-typed actions? Say, I want an action to return a value. Should or shouldn't I need to specify the return type in the action block itself? (The action needs to necessarily return a value of the said type in such case) |
Beta Was this translation helpful? Give feedback.
-
Yes. I think we should static types in Music Blocks itself. |
Beta Was this translation helpful? Give feedback.
-
Currently repeat block isn't exactly a for loop, in the sense that you do not have access to the counter variable. If we have more of a for ... in block, you could iterate over strings as well, getting the index and the indexed character in each iteration. |
Beta Was this translation helpful? Give feedback.
-
This list is super-helpful. We should label which of these are high shelf, and which are low shelf, as well. |
Beta Was this translation helpful? Give feedback.
-
To my understanding, Music Blocks is a programming language that happens to pack drawing and music features. But, the programming aspects don't seem to have a strong foundation. I think we were restricted a lot by the structure previously as these features were afterthoughts. But, with the new program structure tree, a lot can be built robustly.
I strongly believe types should be standardized and whether it should be static or dynamic needs to be discussed. Even though the code will effectively transpile to JavaScript to run on the browser, we still have features JavaScript (or for that matter any language) doesn't support.
My opinion is that a consistent language pattern will bring us heavy performance gain and make the programs deterministic. Following is my idea of how the language should be.
Building Blocks
Data Types
Identifiers
Since this is a Visual Programming Language the shape of the identifier will not conflict and will be preserved and so any supported character can technically be part of it, but I think we need to enforce some constraints for future transpilation support (e.g. export to another programming language).
I think alphanumeric in addition to underscore and blank space, with the first character not being a numeric digit should be used. If and when export is up, maybe we can replace the blank spaces by underscores.
Conditionals
Loops
Flow
break label
orgoto label
was actually an elegant solution;goto
still must be avoided but abreak label
and acontinue label
could be useful, although it is an obscure case)Expressions
Decimal Algebra
Boolean Algebra
===
is debatable)&&
)||
)!
)&
)|
)~
)^
)<<
)>>
)>>>
)Subroutines
This brings up a question of whether we want the subroutines to be statically-typed (because what does a
void
type subroutine return?).Asynchronicity (and Interrupts)
Standard Library
Data Structures
Types (and dynamicity) are debatable.
Array
Stack (Linear heap)
Dictionary (Map)
Math
General
Trigonometry
String
Miscellaneous
Functional Programming
Some of these are indeed a bit advanced, but my opinion is that Music Blocks could be more than what it is.
Beta Was this translation helpful? Give feedback.
All reactions