Path to ES6, ES7?

corbettbrasing1
Mega Guru

Is there current roadmap to upgrade the platform to ES6, or 7?   I know Helsinki upgraded it to ES5.

56 REPLIES 56

novoscale_gp
Kilo Explorer

Hi All!

This is actually something way too important to let it pass... I'm currently working in complex Schedule Jobs that would be easier to maintain if I could actually us Classes.

Chuck, any luck with the Platform team? I know some major things were updated related to coding for London.

Thanks!

Chuck Tomasi
Tera Patron

I haven't heard anything in the London information I've been reviewing.

Have you submitted an enhancement request? It's a better path for requesting new features than the community. 🙂

Enhancement requests: Tell us how you would improve the ServiceNow product 

novoscale_gp
Kilo Explorer

Hi Chuck! Thank you for pointing that out! I'll submit the enhancement.

 

Now related to Prototype, I noticed that preferred new syntax for 1.6.0 is not working.

The following code works, which is the legacy class-based code:

/** obsolete syntax **/
    
var Person = Class.create();
Person.prototype = {
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
};
    
var guy = new Person('Miro');
guy.say('hi');
// -> "Miro: hi"
    
var Pirate = Class.create();
// inherit from Person class:
Pirate.prototype = Object.extend(new Person(), {
  // redefine the speak method
  say: function(message) {
    return this.name + ': ' + message + ', yarr!';
  }
});
    
var john = new Pirate('Long John');
john.say('ahoy matey');
// -> "Long John: ahoy matey, yarr!"

 

And the following is the preferred:

/** new, preferred syntax **/
    
// properties are directly passed to `create` method
var Person = Class.create({
  initialize: function(name) {
    this.name = name;
  },
  say: function(message) {
    return this.name + ': ' + message;
  }
});
    
// when subclassing, specify the class you want to inherit from
var Pirate = Class.create(Person, {
  // redefine the speak method
  say: function($super, message) {
    return $super(message) + ', yarr!';
  }
});
    
var john = new Pirate('Long John');
john.say('ahoy matey');
// -> "Long John: ahoy matey, yarr!"

 

Should we stick to the legacy one, even though the new one is backward-compatible?

 

Thanks!

Hi,

this workaround could help with the super issue:

var ClassA= Class.create();
ClassA.prototype = {
	initialize: function() {
    },	
	doGreatStuff : function(x){
		 gs.print("Polymorphie is the greatest!!!");
		this.doIt(x);	
	},
	doIt : function(x){
		gs.print("Call doIt ClassA: " + x + " " + this.type);
	},
	type : "A"
};


var ClassB = Class.create();
ClassB.prototype = Object.extendsObject(ClassA, {
	initialize: function() {
    },
	
	doIt : function(x){
		 ClassA.prototype.doIt.call(this, x); //instead of super.doIt(x)
	         gs.print("Call doIt ClassB: " + x + " " + this.type);
	},
	type : "B"
});
var y = new ClassB();
y.doGreatStuff("Input");

//*** Script: Polymorphie is the greatest!!!
//*** Script: Call doIt ClassA: Input B
//*** Script: Call doIt ClassB: Input B

 

Simon Christens
Kilo Sage

I would really like to promote this post

Theres a huge difference from ES5 and forward

Any news about an upgrade?