|
| 18 Dec 2011 08:13 PM |
So this thread is about the numerous inconsistences in the ROBLOX API relating to structures (or data types, if you prefer). I figured there were too much of these and they needed to be fixed, so I decided to make a thread listing as much of them as possible.
Here they are, listed in sections:
-- Deprecation of camelCase, replacement by PascalCase --
camelCase was deprecated and replaced by PascalCase. Yet, there are still some functions, hidden in the API, that only exist in camelCase.
Let me list some of these:
Instance.new (why would Instance.new be camelCase if Instance.Lock, Instance.Unlock and all the rest of the ROBLOX API are PascalCase?!?) CFrame.fromEulerAnglesXYZ CFrame.fromAxisAngle (why would CFrame.fromAxisAngle and CFrame.fromEulerAnglesXYZ be camelCase if CFrame.Angles and all the rest of the ROBLOX API are PascalCase?!?) CFrame.new Vector3.new Vector3int16.new Region3.new Region3int16.new Faces.new UDim2.new Color3.new etc...
In fact, I believe something such as Instance.New looks ugly, but one of these already exists, as described in the next section.
-- BrickColor.new and BrickColor.New --
Both BrickColor.new and BrickColor.New exist, but that's only true for BrickColor. Why wouldn't it be the same with Instance, Vector3 and all the other structures?
-- Lua libraries: userdatas - ROBLOX structures: tables --
Lua libraries, in ROBLOX, are userdatas. Probably to stop players from changing them. Yet, the structures are tables. And they're global too, which is a problem.
If you run the following line of code in a script, Instance.new will be unusable in every script: Instance.new = nil
This is because we are allowed to edit the Instance table and it is global.
The table library or the string library are global too, but they're userdatas, so we can't edit them.
This is completely stupid and makes no sense, we can currently literally use Instance or Vector3int16 as an alternative to _G and shared.
Don't believe me? Ok, do this:
In a script: Instance.lolwut = "hax"
In another script: print(Instance.lolwut)
The output will print "hax". No, seriously.. You can use any of these as an alternative to _G...
Ok, so now, here are all the alternatives to _G that we know:
Faces Instance Region3int16 Region3 Color3 Vector3 Vector3int16 UDim2 BrickColor shared
We have lots of alternatives to _G, don't we? :)
Seriously, this is ridiculous. Keep your API clean, consistent and logical, devs. |
|
|
| Report Abuse |
|
|
pwnedu46
|
  |
| Joined: 23 May 2009 |
| Total Posts: 7534 |
|
|
| 18 Dec 2011 08:34 PM |
print(string.rep("ROBLOX, Y U SO INCONSISTENCY?!?!", 9001))
---------- ~ pwnedu46, the unicorn ~ |
|
|
| Report Abuse |
|
|
Aaaboy97
|
  |
| Joined: 05 Apr 2009 |
| Total Posts: 6612 |
|
|
| 18 Dec 2011 08:37 PM |
Brick.formFactor Brick.FormFactor -- used to error saying it's not allowed to be use, I think it still does |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 18 Dec 2011 08:42 PM |
| ROBLOX is still in Beta. Kind of a problem... right? |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2011 08:47 PM |
"ROBLOX is still in Beta. Kind of a problem... right?"
Well, not that much. Minecraft was just released officially, even though it reached millions of users before it even got released.
Proof that ROBLOX is still in beta:
print(version()) --> 0.49.0.444 |
|
|
| Report Abuse |
|
|
LPGhatguy
|
  |
 |
| Joined: 27 Jun 2008 |
| Total Posts: 4725 |
|
|
| 18 Dec 2011 10:24 PM |
| As far as your problems with the constructors that are members of data types, keep in mind that that's the norm. It's not a normal member, it's a constructor. It creates a new instance. And that is deserving of camelCase. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2011 12:59 AM |
"As far as your problems with the constructors that are members of data types, keep in mind that that's the norm. It's not a normal member, it's a constructor. It creates a new instance. And that is deserving of camelCase."
Then explain BrickColor.New. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2011 11:45 AM |
| 0.49?? Roblox is less than halfway from getting released?? |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 19 Dec 2011 11:53 AM |
Some responses:
> Deprecation of camelCase, replacement by PascalCase > --------------------------------------------------- > > Some functions exist in camelCase: > > * `[object].new` > * `CFrame.fromEulerAnglesXYZ` > * `CFrame.fromAxisAngle`
These are not methods, but functions, or in java terminology, "static methods". Don't make the mistake of comparing them to `:GetChildren()`, which is conceptially different, so warrants a potentially different casing. I'd say that `Instance.Lock` and `instance.Unlock` are the outliers here.
> Lua libraries: userdatas - ROBLOX structures: tables > ---------------------------------------------------- > Lua libraries, in ROBLOX, are userdatas. Probably to stop players from > changing them. Yet, the structures are tables. And they're global too, which > is a problem. If you run the following line of code in a script, Instance.new > will be unusable in every script: > > Instance.new = nil > > This is because we are allowed to edit the Instance table and it is global.
This is a good thing. It means you can modify the behaviour of Instance.new in every script in your place very easily. Heck, you should be writing all of the code, and you're an idiot if you run `Instance.new = nil` |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2011 11:57 AM |
@king
Its released when they have finally added enough annoyances to get 90% of robloxia buy bc. |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2011 12:00 PM |
Add enough annoyances part: accomplished 1 year ago Getting enough players to buy BC: will accomplish in 2 months |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2011 02:07 PM |
"These are not methods, but functions, or in java terminology, "static methods". Don't make the mistake of comparing them to `:GetChildren()`, which is conceptially different, so warrants a potentially different casing. I'd say that `Instance.Lock` and `instance.Unlock` are the outliers here."
I know they're not methods. Yet, some of them are PascalCase and some others are camelCase. That's the thing that is inconsistent.
"This is a good thing. It means you can modify the behaviour of Instance.new in every script in your place very easily. Heck, you should be writing all of the code, and you're an idiot if you run `Instance.new = nil`"
Being able to edit the ROBLOX API at runtime is good? O_O
If so, then that means they should make the string library, the table library and all the other libraries editable. |
|
|
| Report Abuse |
|
|
NXTBoy
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 4533 |
|
|
| 20 Dec 2011 06:34 AM |
> Being able to edit the ROBLOX API at runtime is good? O_O > If so, then that means they should make the string library, the table library and all the other libraries editable.
Absolutely. `table` and `string` _did_ use to be modifiable. It was awesome, particularly since code like this worked:
string.makeFunny = function(s) return s..", lol" end
str = ("this is not funny"):makeFunny() print(str)
Try it in the online lua demo. It works.
It was removed because this was a security vulnerability, since the then-equivalent of `CoreScript`s would run the modified code at elevated privileges.
The correct solution would have been to simply run elevated code in a different environment that the user doesn't have access to, but instead they restricted access to all environments.
|
|
|
| Report Abuse |
|
|
|
| 20 Dec 2011 02:38 PM |
"Absolutely. `table` and `string` _did_ use to be modifiable. It was awesome, particularly since code like this worked:
string.makeFunny = function(s) return s..", lol" end
str = ("this is not funny"):makeFunny() print(str)
Try it in the online lua demo. It works.
It was removed because this was a security vulnerability, since the then-equivalent of `CoreScript`s would run the modified code at elevated privileges.
The correct solution would have been to simply run elevated code in a different environment that the user doesn't have access to, but instead they restricted access to all environments."
But, what if a script edited the string library and another script expects it to work the normal way? |
|
|
| Report Abuse |
|
|