mapc | 2011-12-16 12:57
Generell discussion about the cube scripting language

RaZgRiZ | 2011-12-12 13:00



Cubescript is hard to read to those who are either too accustomed to reading everything with syntax highlighting or don't like cubescript in any way. Or when someone is truly horrible at doing things right. Apart from that however..

He may not be the first, or the second, or the third, what does it matter. For cubescript, it's practically the first command-line quick-connect script, with mine coming second but being SVN only. I do wonder however how you're doing to implement such a thing into the framework, is it based on cubescript at all? Or are you hoping to convert it to another language?

And i'm confident he will add the comments necessary. Would would go past thing chance for fame? ^_^
reply to 3starRaZgRiZ

mapc | 2011-12-12 17:46



(I switched from the gandalf acc to this one, sorry for the confusion).

Yes, apply 1 and 2 for me :D (but it is not that bad).
Sadly cbs is a very bad designed language: There is for instance only a global namespace and there is only strings. Even the lists are space separated, not escaped strings. (I'd like to give you a complete lists, but this would be one or two paragraphs of text, so not in this comment ;) ).

Yes, thats why I am thinking about integrating it :). However, command line again means a problem with the global namespace :(
The framework is entierely cubescript and aims at resolving some of the issues, nicer installation, plugin-based (no more hazzle with adding stuff to autoexec.cfg) and a little bit of namespacing:

(concatword $namespace $varname) = $value

Yup, hope so :)

Cheers,
mapc

srbs | 2011-12-14 04:46



@mapc
"I'd like to give you a complete lists, but this would be one or two paragraphs of text, so not in this comment ;)"
I'd love to see this list.

"Sadly cbs is a very bad designed language:"
Not every language NEEDS every feature known to the programming world. It is perfectly adequate for what it is designed for.

What isn't designed very well is, in fact, your "framework." For large projects like that, one should (as with all languages) first learn the features, quirks, and idioms of said language and design accordingly. And if my config.cfg file is some 500KB after using 0.9.4, I won't ever use it again, especially since every function of every script has variable names relating to the current plug-in

@Razgriz
"Would would go past thing chance for fame?"
wut?

srbs

mapc | 2011-12-15 12:48



@srbs

I do not criticize the lack of features in the language, but the way the language is designed (in other words: how you do, what you do with cbs).

Your last argument was an ad hominem argument (http://en.wikipedia.org/wiki/Ad_hominem) and therefore a rhetorical trick without being constructive at all. Please stop this, I am annoyed by this.
Your config file is that big, because the way configuration works (described below) and because of the lack of memory management (described also below). Big codebase => Big conf. This issue can not be resolved without having control of the configuration process. Sorry.
The framework is btw written with some of the issues below in mind. The usage of vars for every plugin for instance makes the whole framework much more secure.
The Points of criticism:

Everything is a string (partially lack of types)
Lists are space-seperated not-escaped lists
There are too many ways to generate and modify function-strings (e.g. macros, the three braces)
There are too many ways to call function-strings (macros, as closures...)
Metaprogramming is just string-modification and can be applied everywhere
There is just a global namespace
There are no named arguments, no function signatures
No deallocation possible
Inefficient config file
Operators are functions, but the function names are symbols
No error handling
Lack of C++ documentation (how does it work internally?)

Why this is bad:

Everything is a string means that everything is executable, which can enable an attacker to execute code in some cases. Although it is easily possible to write forkbombs and other malware for cbs, this is probably not really an horror scenario, because masterlist-providers can inject code anyway. There other scenarios, where this can be dangerous: It can lead to data(=>code,state) corruption if random data is executed (just imagine a bug where someone executes a long string of human language). Such a corrupted block might even spread…corrupted code generated more corrupted code with metaprogramming. (I call this disease cubic cancer ;) ). Also it makes debugging a lot harder and even can hide bugs, this of course goes hand in hand with error handling: No error handling => no error on code corruption.
The problems I just described could be contained a bit if there where types and function signatures anyway (line with 8 words, can not be called for function that requires 3 args; can not call a function that requires lists for a line of human language) and again…error handling.
Now there is a lot of problems with the seperation between data and code, but there is an additional problem: The usage of complicated string manipulation methods: You can use multiple Macros of different levels, macros are hard to distinguish from actual variables and their usage varys depending on the level of rect brackets. Calling a function seems to be equivalent with accessing the string one macro level deeper. Then there are two kinds of string defining symbols: [...] and "..." witch both output a string (or you can just use none of them), there are also round braces witch evaluate the code immediately. This is apperantly still a little buggy, because some strings are not recognized as entire commands and in some cases the macro modifier is not recognized (I remember, that I tried to fill a bug report about this/talk to the devs about this, I also remember that I have been somewhat unsuccessful).

The next big block of criticism is the available variable space: Ther is only the global namespace. Not a local one, no packages/namespaces, only one. In other words: You iterate over a list using I as iterator and one other function you call does the same: You are screwed. If someone else in a completely different script decides to call his var 'roster' too...you are screwed. But not only is the cbs-namespace a mess, cubescript is also one single memory leak. no RAM at all is being deallocated, try this:

testnum = 0
testmax = 2048

buildup = [ if (*smaller* $i $m) [ s = (concatword $s $s $s $s $s $s $s $s $s $s); i = (* $i 10); sleep 1 [ buildup ] ] ]
test = [
if (*smaller* $testnum $testmax) [
s = a
i = 0
m = (pow 1024 2)
buildup

sleep 1 [ test ]
]
]

The code above builds string with the size of 1M and deletes it. It does that 2048 times. The memory consumption here should not be higher than 4M (this is generous). Actually it needed about a second to fill my entire RAM.
The next thing is that the configuration is done by writing the entire state => corrupted data and functions written.
The lists are bad for the obvious reason (lets append "mapc is stupid" to the end of a list ;) ).
Operators are just badly designed, using symbols but the arithmetic of functions is inconsistent.
And at last: There are about 5 lines of comment in the entire cube engine, maybe one in the cbs code. This makes it very hard to understand the internals, even if you can read C++.

Well, I am pretty exhausted. There are some ways how you can work around this problems, I'll write them down tomorrow :) .
You said you think cbs is perfect for it's purpose, what makes you think that?
Cheers,
mapc
reply to mapc

skiingpenguins | 2011-12-15 20:38



cube script isnt supposed to be as fancy as you seem to want it. i think you should chill out, and maybe go to a different game if you want something with all these feature things. cube script serves it's purpose very well. don't mess with it.
reply to 3starskiingpenguins

mapc | 2011-12-16 01:06



@skiingpenguins

Excuse me? Do you have the faintest idea what my essay meant, have you ever spent a single thought on programming language design, have you ever thought a second about application design? Please, do not waste my time! If you did not understand what I said, that's ok. I'll even explain it to you (somewhere else), but a statement like yours is not worthy an answer and I won't feed the trolls again…
reply to mapc

Chaos | 2011-12-16 02:29



Cubescript is a low-level language; hence, it's applications don't really go beyond those for which it was designed. However, in my opinion, cubescript really servers it's purpose well, accommodating a wide range of uses that relate to the game.
reply to 1starChaos

Suicizer | 2011-12-16 08:30



? This maybe has nothing to do with your content, but CubeScript doesn't seems like a low-level programming language to me. I would rather take OpenGL as example for a low-level programming language as CubeScript.

0
points
 (0 votes)
User login
Users on Quadropolis
1 guest & no users online
30
points ]
 (3 votes)
Created 2019-05-17 21:51
5 years 27 weeks ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
4 years 23 weeks ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 26 weeks ago
8
points ]
 (1 vote)
Created 2024-06-02 14:26
24 weeks 5 days ago
8
points ]
 (1 vote)
Created 2024-06-02 22:13
24 weeks 4 days ago
vampirefrog
Created 2024-04-11 22:25
32 weeks 23 hours ago
vampirefrog
29
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 25 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
4 years 4 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
40 weeks 5 days ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
1 year 17 weeks ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
3 years 49 weeks ago
Created 2023-12-12 23:34
49 weeks 2 days ago
Zoocata
Created 2023-11-27 23:00
51 weeks 3 days ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
1 year 7 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 23 weeks ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 28 weeks ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 38 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 42 weeks ago
Created 2023-01-19 19:36
1 year 44 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 45 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN