Giter Site home page Giter Site logo

Comments (5)

srodriguez avatar srodriguez commented on June 5, 2024

Steph, that's a great idea. However, should capacity definition allow default values?
For agent or behavior actions, it would be clear.

from sarl.

gallandarakhneorg avatar gallandarakhneorg commented on June 5, 2024

Yes, I guess.
It may be very helpful for the capacity caller to have default values.

We may discuss on the default parameters in Skills.
I have in my mind the default value in the C++.
Let the Capacity is analog to the declaration in the header, and the Skill is analog to the definition in the code file. It is common to define the default values in the header file and not in the code file.
Consequently, the best practice is to define the default values in the Capacity, and not in the Skill.
Is it possible to generate a compilation error when a default value is written in the Skill?

from sarl.

gallandarakhneorg avatar gallandarakhneorg commented on June 5, 2024

I propose the following syntax:

def myAction1(a : String, b : int = 35) { CODE1 }
def myAction2(a : String, b : int = 35, c : char) { CODE2 }

The generated Java functions will be:

public void myAction1(String a, int b) { CODE1 }
public void myAction1(String a) { myAction1(a, 35); }
public void myAction2(String a, int b, char c) { CODE2 }
public void myAction2(String a, char c) { myAction2(a, 35, c); }

from sarl.

gallandarakhneorg avatar gallandarakhneorg commented on June 5, 2024

Let the following code with ambiguity:

def myAction(a : char, b : int = 1, c : int = 2, d : char) { }

The generated Java code may be:

public void myAction(char a, int b, int c, char d) { }
public void myAction(char a, int b, char d) { myAction(a,b,2,d); }
public void myAction(char a, char d) { myAction(a,1,2,d); }

from sarl.

gallandarakhneorg avatar gallandarakhneorg commented on June 5, 2024

Since we are using Xtext 2.6, (issue #93), the jvm inferrer and the validator are not working any more.

from sarl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.