Skip to main content
↑
↓
Spherical forums
Community for the
Sphere game engine
New?
Contact Us
to register an account!
1 Hour
1 Day
1 Week
1 Month
Forever
Community
Help
Search
Recent Posts
Log in
Contact Us
News
Spherical
Facebook
-
Twitter
-
Discord chat
New?
Contact us
to register an account!
Sphere Development
Sphere General
Object.defineProperty in Sphere 1.5?
1
Print
Topic: Object.defineProperty in Sphere 1.5?
(Read 4245 times)
previous topic
-
next topic
0 Members and 1 Guest are viewing this topic.
N E O
Hero Poster
Posts: 585
Making it happen!
Logged
Administrator
Senior Administrator
Object.defineProperty in Sphere 1.5?
November 17, 2014, 11:34:12 pm
I'm currently unable to access my Windows laptop that has Sphere 1.5 on it; can someone with easier access to their 1.5 setup confirm whether or not the
Object.defineProperty
method of getters & setters works? I know much of my old Sphere code uses older getters and setters tactics and I'd much rather recommend something more modern and standardized to those who want to raise their JS level.
Flying Jester
Legendary Poster
Posts: 1,161
Logged
TurboSphere Developer
Re: Object.defineProperty in Sphere 1.5?
Reply #1
–
November 17, 2014, 11:51:17 pm
The Linux and Macintosh 1.6+ versions I have don't have it to be sure, and I pumped the libjs version in my OS X version as high as it would go before API breakage.
So I doubt it.
Learn some history?
The Flying Jester's Blog of Sorts
Fat Cerberus
Big Chungus
Posts: 2,774
*MUNCH*
Logged
Global Moderator
Sphere Developer
Re: Object.defineProperty in Sphere 1.5?
Reply #2
–
November 18, 2014, 12:17:38 am
No, it does not. Sphere 1.5 uses JS 1.5, an incredibly ancient version of SpiderMonkey (2003 according to Sphere editor's About dialog).
neoSphere 5.9.2
-
neoSphere
engine -
Cell
compiler -
SSj
debugger
forum thread
|
on GitHub
Radnen
Big Chungus
Posts: 1,440
Sphere Studio Developer
Logged
Senior Staff
Wise Warrior
Re: Object.defineProperty in Sphere 1.5?
Reply #3
–
November 19, 2014, 12:28:13 am
Lord English, I noticed you do this sometimes:
Code: (javascript)
[Select]
function object() {
this.something = getter function() {
}
}
Which is interesting since my ECMA 1.5 compliant SSFML doesn't see that as valid syntax (SpiderMonkey has it's quirks). You could use __defineSetter__() or __defineGetter()__... But again I only added that as a polyfill utilizing Object.defineProperty... so I guess that originally didn't work either, but at least it's a bit more compatible since I'm not keen on adding extra syntax handling to Jurassic's lexical analyzer (const was enough!).
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.
Sphere-sfml
here
Sphere Studio editor
here
Fat Cerberus
Big Chungus
Posts: 2,774
*MUNCH*
Logged
Global Moderator
Sphere Developer
Re: Object.defineProperty in Sphere 1.5?
Reply #4
–
November 19, 2014, 08:16:15 am
Yeah, prop getter/setter is a non-standard Mozilla way to do it in older SpiderMonkey versions before defineProperty was a thing. It doesn't work anymore in SM either, so no use getting worked up over it. If you see that, it's older code I wrote; I try to avoid it now.
neoSphere 5.9.2
-
neoSphere
engine -
Cell
compiler -
SSj
debugger
forum thread
|
on GitHub
N E O
Hero Poster
Posts: 585
Making it happen!
Logged
Administrator
Senior Administrator
Re: Object.defineProperty in Sphere 1.5?
Reply #5
–
November 19, 2014, 09:54:55 am
So...yea, three different ways to get/set, but only one is current standard.
Can someone with more time than me get a working Object.defineProperty polyfill? I'm fine with it being prototyped directly onto Object.
Fat Cerberus
Big Chungus
Posts: 2,774
*MUNCH*
Logged
Global Moderator
Sphere Developer
Re: Object.defineProperty in Sphere 1.5?
Reply #6
–
November 19, 2014, 10:47:47 am
It's pretty much impossible to polyfill, so much of its functionality requires hooks in the underlying JS engine that older engines just don't have. Even MDN doesn't list a polyfill for it.
neoSphere 5.9.2
-
neoSphere
engine -
Cell
compiler -
SSj
debugger
forum thread
|
on GitHub
1
Print
Sphere Development
Sphere General
Object.defineProperty in Sphere 1.5?