Git Product home page Git Product logo

wollok's Introduction

Codacy Badge Travis Coverage Status Gitter

Wollok

A programming language and environment for teaching OOP.

Xtext-based implementation notes

This is the main repository for the Wollok Xtext-based implementation, which is part of the Wollok Language Specification

Installation

You have two options to download an use Wollok. Download a complete Wollok Product Distribution:

  • Linux 64 bits
  • Mac 64 bits
  • Windows 64 bits

Update Site (if you already have a compatible eclipse):

Wollok SDK standalone

Finally if you just want the headless Development Kit (WDK), for example to use a different IDE than Eclipse, you can download it from

This is useful for example if you are going to develop with Sublime or any other lightweight text editor

Documentation

Refer to the wiki for documentation like Language Reference and Environment.

What's the language like ?

  • Object Oriented
  • Non "class-centered". Allows you to create objects as first-class citizens without the need of classes. To start working with objects without introducing complex subjects and mechanisms as hierarchies, overriding methods, etc.
  • Tries to maximize compile-time checks while keeping the power of a dynamic language.
  • With implicit types: by means of a type system and type inference mechanism.
  • A clean modern syntax avoiding unnecessary symbols (java) while keeping it simple and even familiar for those who already have some experience in programming)
  • Interpreted: means that the code is being evaluated as it's being read. Although its declarative syntax makes it feel like a compiled language
package fliers {

   object superman {
        method fly(to) {
             // ...
        }
   }

   class Plane {
        method fly(to) {
            // ...
        }
   }

}

  val aBird = object {
        method fly(to) {
             // ...
        }
  }

  [ superman, new Plane(), aBird ].forEach { o => o.fly() }

Check out our Language Reference for a concrete idea of the syntax

How is the Environment ?

You can either use its IDE:

  • Completely integrated with Eclipse.
  • With: many static code analysis, Quick-Fixes, Refactors
  • An interactive Console (REPL)
  • Visual representations: Outline, Static diagram, Objects Diagrams

Or use the wollok-cli which has command line tools for running and checkin a program.

How to Contribute

If you want to contribute to the Wollok development that would be awesome ! We have set a number of wiki pages to help you start, and also documented conventions and instructions for different tasks.

See https://github.com/uqbar-project/wollok/wiki/Development

License

Copyright © 2016, Uqbar Project Foundation, All Rights Reserved.

Distributed under the terms of LGPLv3 https://www.gnu.org/licenses/lgpl-3.0.txt

Contributors

Metrics

PRs closed PRs

issues issue resolution

open issues

wollok's People

Contributors

alete89 avatar briancraig avatar charlyraffellini avatar dfortini avatar fdodino avatar flbulgarelli avatar gitter-badger avatar guusy avatar ivojawer avatar javierfernandes avatar javiergelatti avatar jcontardo avatar juanbono avatar juancete avatar juanfds avatar ldevoto avatar lgassman avatar lspigariol avatar matifreyre avatar maurocasciati avatar mmatos avatar nicovio avatar npasserini avatar nykros avatar palumbon avatar tesonep avatar waffle-iron avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wollok's Issues

[debugger] StackTrace view explodes while debugging

When it pauses in a breakpoint then trying to inspect the stack shows an error
screen shot 2015-04-02 at 11 38 48

And the following error in console

!ENTRY org.eclipse.core.jobs 4 2 2015-04-02 11:37:05.858
!MESSAGE An internal error occurred during: "child count update".
!STACK 0
java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy44.getStackFrames(Unknown Source)
    at org.uqbar.project.wollok.ui.debugger.WollokDebugTarget.getStackFrames(WollokDebugTarget.java:224)
    at org.uqbar.project.wollok.ui.debugger.model.WollokThread.getStackFrames(WollokThread.java:33)
    at org.eclipse.debug.internal.ui.model.elements.ThreadContentProvider.getChildCount(ThreadContentProvider.java:29)
    at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.retrieveChildCount(ElementContentProvider.java:118)
    at org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$2.run(ElementContentProvider.java:67)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
    at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786)
    at java.io.ObjectOutputStream.reset(ObjectOutputStream.java:503)
    at net.sf.lipermi.handler.ConnectionHandler.sendMessage(ConnectionHandler.java:182)
    at net.sf.lipermi.handler.ConnectionHandler.remoteInvocation(ConnectionHandler.java:207)
    at net.sf.lipermi.handler.CallProxy.invoke(CallProxy.java:58)
    ... 7 more

!ENTRY org.eclipse.core.jobs 4 2 2015-04-02 11:38:41.915
!MESSAGE An internal error occurred during: "Check Debug Command".
!STACK 0
java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy44.getStackFrames(Unknown Source)
    at org.uqbar.project.wollok.ui.debugger.WollokDebugTarget.getStackFrames(WollokDebugTarget.java:224)
    at org.uqbar.project.wollok.ui.debugger.model.WollokThread.getStackFrames(WollokThread.java:33)
    at org.uqbar.project.wollok.ui.debugger.model.WollokThread.canStepReturn(WollokThread.java:138)
    at org.eclipse.debug.internal.core.commands.StepReturnCommand.isSteppable(StepReturnCommand.java:27)
    at org.eclipse.debug.internal.core.commands.StepCommand.isExecutable(StepCommand.java:46)
    at org.eclipse.debug.core.commands.AbstractDebugCommand$UpdateJob.run(AbstractDebugCommand.java:101)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:116)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
    at java.io.ObjectOutputStream$BlockDataOutputStream.drain(ObjectOutputStream.java:1877)
    at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(ObjectOutputStream.java:1786)
    at java.io.ObjectOutputStream.reset(ObjectOutputStream.java:503)
    at net.sf.lipermi.handler.ConnectionHandler.sendMessage(ConnectionHandler.java:182)
    at net.sf.lipermi.handler.ConnectionHandler.remoteInvocation(ConnectionHandler.java:207)
    at net.sf.lipermi.handler.CallProxy.invoke(CallProxy.java:58)
    ... 8 more

[scm] remove all gen code from versioning

Still keep the folders empty to avoid compilation problems while importing in eclipse

i.e.:
org.uqbar.project.wollok.lib/xtend-gen/
org.uqbar.project.wollok.ui/plugin.xml_gen
org.uqbar.project.wollok/model/generated/

EValidator fails trying to validate method for message to "this"

EValidator failed on this program when we added "this.bono()"

object pepe {
var categoria
var faltas
var bonoproductividad = true
var productividad = 50

method sueldobase() {
    return categoria.sueldobase(faltas)
}

method setcategoria(nuevacategoria){
    categoria = nuevacategoria
}

method setfaltas(unafalta){
        faltas = unafalta
    }
method sueldo(){
    if (bonoproductividad){
        return this.sueldobase() * (1 + this.bono())
    }
    else{
        return this.sueldobase()
    }
}
method bono(){
    if (productividad == 50){
        return 0.25
    }

else if (productividad >=50){
    return 0.1
}

else {
    return 0
    }
}

}

object catGerente {
method sueldobase(faltas) {
return 2500
}
}

object cadete{
method sueldobase(faltas){
if (faltas==0){
return 2300 + 500
}
else {
return 2300
}
}
}

Error message:
ERROR main - Error executing EValidator
java.lang.IllegalArgumentException: Unhandled parameter types: [org.uqbar.project.wollok.wollokDsl.impl.WNamedObjectImpl@2269f2 (name: pepe), org.uqbar.project.wollok.wollokDsl.impl.WMemberFeatureCallImpl@654635 (nullSafe: false, feature: sueldobase)]
at org.uqbar.project.wollok.model.WollokModelExtensions.isValidCall(WollokModelExtensions.java:630)
at org.uqbar.project.wollok.validation.WollokDslValidator.methodInvocationToThisMustExist(WollokDslValidator.java:285)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:311)
at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:66)
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:127)
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:145)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:123)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:86)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:184)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:179)
at org.uqbar.project.wollok.launch.WollokLauncher.parse(WollokLauncher.java:156)
at org.uqbar.project.wollok.launch.WollokLauncher.doMain(WollokLauncher.java:85)
at org.uqbar.project.wollok.launch.WollokLauncher.main(WollokLauncher.java:61)
ERROR main - Error executing EValidator
java.lang.IllegalArgumentException: Unhandled parameter types: [org.uqbar.project.wollok.wollokDsl.impl.WNamedObjectImpl@2269f2 (name: pepe), org.uqbar.project.wollok.wollokDsl.impl.WMemberFeatureCallImpl@636ea3 (nullSafe: false, feature: bono)]
at org.uqbar.project.wollok.model.WollokModelExtensions.isValidCall(WollokModelExtensions.java:630)
at org.uqbar.project.wollok.validation.WollokDslValidator.methodInvocationToThisMustExist(WollokDslValidator.java:285)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:311)
at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:66)
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:127)
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:145)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:123)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:86)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:184)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:179)
at org.uqbar.project.wollok.launch.WollokLauncher.parse(WollokLauncher.java:156)
at org.uqbar.project.wollok.launch.WollokLauncher.doMain(WollokLauncher.java:85)
at org.uqbar.project.wollok.launch.WollokLauncher.main(WollokLauncher.java:61)
ERROR main - Error executing EValidator
java.lang.IllegalArgumentException: Unhandled parameter types: [org.uqbar.project.wollok.wollokDsl.impl.WNamedObjectImpl@2269f2 (name: pepe), org.uqbar.project.wollok.wollokDsl.impl.WMemberFeatureCallImpl@17486b3 (nullSafe: false, feature: sueldobase)]
at org.uqbar.project.wollok.model.WollokModelExtensions.isValidCall(WollokModelExtensions.java:630)
at org.uqbar.project.wollok.validation.WollokDslValidator.methodInvocationToThisMustExist(WollokDslValidator.java:285)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator$MethodWrapper.invoke(AbstractDeclarativeValidator.java:118)
at org.eclipse.xtext.validation.AbstractDeclarativeValidator.internalValidate(AbstractDeclarativeValidator.java:311)
at org.eclipse.xtext.validation.AbstractInjectableValidator.validate(AbstractInjectableValidator.java:66)
at org.eclipse.xtext.validation.CompositeEValidator.validate(CompositeEValidator.java:127)
at org.eclipse.emf.ecore.util.Diagnostician.doValidate(Diagnostician.java:171)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:158)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:185)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:181)
at org.eclipse.xtext.validation.CancelableDiagnostician.doValidateContents(CancelableDiagnostician.java:48)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:161)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:137)
at org.eclipse.xtext.validation.CancelableDiagnostician.validate(CancelableDiagnostician.java:36)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:120)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:145)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:123)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:86)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:184)
at org.uqbar.project.wollok.launch.WollokLauncher.validate(WollokLauncher.java:179)
at org.uqbar.project.wollok.launch.WollokLauncher.parse(WollokLauncher.java:156)
at org.uqbar.project.wollok.launch.WollokLauncher.doMain(WollokLauncher.java:85)
at org.uqbar.project.wollok.launch.WollokLauncher.main(WollokLauncher.java:61)
ERROR:Error executing EValidator ( line : null)
ERROR:Error executing EValidator ( line : null)
ERROR:Error executing EValidator ( line : null)

Error using min method on collections

when doing:
return golonrinas.min[p | p.energia()]

where energia is an integer

I get this error:
java.lang.ClassCastException: org.uqbar.project.wollok.interpreter.nativeobj.WollokInteger cannot be cast to java.lang.Comparable

Investigate how to implement unitTests for Code Formatter

It would be really cool to have unitary automatic tests for code formatting.

Formatting logic is really difficult, since sometimes you fix a certain scenario but breaks another one.

Is there anyway to automatise this kind of tests ?

Check over MessageNotUnderstood implementation

It has some implementations that might be needed for other "wollok runtime" exceptions.
But the comment states it might not longer be necessary...

class MessageNotUnderstood extends WollokRuntimeException {
// Esto es previo a tener la infraestructura de debugging
// probablemente seria bueno unificar el manejo de errores con eso
var Stack wollokStack = new Stack

new(String message) {
    super(message)
}

def pushStack(WFeatureCall call) { wollokStack.push(call) }

override getMessage() '''«super.getMessage()»
    «FOR m : wollokStack»
    «(m as WExpression).method?.declaringContext?.contextName».«(m as WExpression).method?.name»():«NodeModelUtils.findActualNodeFor(m).textRegionWithLineInformation.lineNumber»
    «ENDFOR»
'''

def getInternalMessage(){
    super.message
}

}

Float numbers equality is wrong

For example assertEquals(1.4*1.4, 1.96) fails with:

AssertionFailed: Expected [1.9599999999999997] but found [1.96]

I think we should change any double in the interpreter for a BigDecimal, which will have the expected behaviour.

The recursive programs are not working as expected

This program is not working, I could not detect the problem.

object pajarera{
    var pajaros = #[pepita,pepe,pepona]

    method agregarA(pajaro){
        pajaros.add(pajaro)
    }

    method sacarA(pajaro){
        pajaros.remove(pajaro)
    }

    method cuantosHay(){
        return pajaros.size()
    }

    method getPajaros(){
        return pajaros
    }

    method alimentarATodosCon(comida){
        pajaros.forEach[p|p.comer(comida)]
    }

    method hacerVolarATodas20M(metros){
        pajaros.forEach[p|p.volar(metros)]
    }

    method cualEstaSaludable(){
        return pajaros.filter[p|p.energia() > 100]
    }


    method retornaEnergias(energiaMinima){
        return  pajaros.filter[p|p.energia() < energiaMinima]
    }




    method el(){
        var filtro1 = #[]
        var filtro2 = #[]
        var filtro3 = #[]

        filtro1 = pajaros.filter[p|p.energia() <= pepita.energia()]
        filtro2 = filtro1.filter[pp|pp.energia() <= pepona.energia()]
        filtro3 = filtro2.filter[ppp|ppp.energia() <= pepe.energia()]


        //var filtro2 = filtro1.filter[pp|pp.energia() > pepe.energia()]
        //return filtro2.filter[ppp|[ppp.energia() > pepona.energia()]]

        return this.comparaEnergia(filtro3)


    }

    method alimentaBajaEnergia(filtro3){
        filtro3.forEach[pppp|pppp.com()]
        //pepe.com()
        this.comparaEnergia(filtro3)
    }

    method comparaEnergia(filtro3){
        var filtro4 = #[]
        filtro4 = filtro3.filter[p|p.energia() >= 30]

        if(filtro4.size() == 0){    

            this.alimentaBajaEnergia(filtro3)
            //return pepe.energia()
        }else{
            return "La energia de pepe es 30"
        }
    }

    method esta(pajaro){
        return pajaros.contains(pajaro)
    }

    method getEnergias(){
        return pajaros.map[p|p.energia()]
    }

    method estanTodosVivos(){
        return pajaros.forAll[p|p.energia() > 0]
    }
}
object pepita{
    var energia = 30

    method volar(metros){
        return energia -= 10
    }

    method comer(comida){
        energia -= comida.energia()
    }
    method energia(){
        return energia
    }
}

object pepona{
    var energia = 20

    method volar(metros){
        return energia -= 20
    }

    method comer(comida){
        energia -= comida.energia()
    }
    method energia(){
        return energia
    }
}

object pepe{
    var energia = 10

    method volar(metros){
        return energia -= 5
    }

    method comer(comida){
        energia -= comida.energia()
    }

    method com(){
        energia += 10
    }

    method energia(){
        return energia
    }

}

variables and numbers example fails with NPE in wollokEquals

Try to run 1-variables-and-numbers.wpgm

Fails with this

Caused by: org.uqbar.project.wollok.interpreter.WollokInterpreterException: Error evaluating line file:/Users/jfernandes/dev/data/repo/wollok/wollok-tests/src/1-variables-and-numbers.wpgm:[26]: this.assertEquals(8.0, 2**3)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:192)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.eval(WollokInterpreterEvaluator.java:118)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:124)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator$1.apply(WollokInterpreterEvaluator.java:1)
    at org.eclipse.xtext.xbase.lib.IteratorExtensions.fold(IteratorExtensions.java:626)
    at org.eclipse.xtext.xbase.lib.IterableExtensions.fold(IterableExtensions.java:534)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evalAll(WollokInterpreterEvaluator.java:127)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:165)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evaluate(WollokInterpreterEvaluator.java:626)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:180)
    ... 7 more
Caused by: java.lang.NullPointerException
    at org.uqbar.project.wollok.interpreter.api.WollokInterpreterAccess.wollokEquals(WollokInterpreterAccess.java:25)
    at org.uqbar.project.wollok.interpreter.core.WollokNativeLobby.assertEquals(WollokNativeLobby.java:152)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.uqbar.project.wollok.interpreter.nativeobj.AbstractWollokDeclarativeNativeObject.call(AbstractWollokDeclarativeNativeObject.java:40)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._call(WollokInterpreterEvaluator.java:566)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.call(WollokInterpreterEvaluator.java:654)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.perform(WollokInterpreterEvaluator.java:562)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator._evaluate(WollokInterpreterEvaluator.java:532)
    at org.uqbar.project.wollok.interpreter.WollokInterpreterEvaluator.evaluate(WollokInterpreterEvaluator.java:630)
    at org.uqbar.project.wollok.interpreter.WollokInterpreter.eval(WollokInterpreter.java:180)
    ... 16 more

Improve code formatting

Named objects and Object Literals are terrible.

Also methods indentations and line break, as well as list literals and parameters.

Oh and also it forces a space in the dot used to send messages. Ugly

Fix XPect tests

Many are failing due to the changes that we made in the syntax to forbid mixing up classes with programs.
They mix classes within programs.

We probably need to make a step back there, and allow a flexible syntax. Letting you define classes and objects in programs.

That will make our life easier

Add Ranges as collections.

The message 1.to(10), generates a new WList[1,2,3,4,5,6,7,8,9,10]

The message 1.toByStep(3,0.5) generates WList[1, 1.5, 2, 2.5, 3]

Incorrect error in editor: unused variable

object pepita {
var energia = 100

method energia() { energia }
method volar(metros) { energia -= metros * 4 }

}

Marks "energia" as unused variable, which is not true

[interpreter] ensure single instance of immutable objects like numbers

Today the interpreter creates new instances of the same numbers appearing in different parts of a program.
For example:

val a = 10

val b = 10

Then there will be 2 instances of the number "10". It would be good to cache this and use the same instance. Specially to simplify the object diagram

Recursive modifying of a variable is not working

pajarera {
    var energiaMenor = 100 
    var pajaros = #[pepita, pepe]
    method menorValor(){
        pajaros.forEach[a | a.sosMenor(energiaMenor)]
        return energiaMenor
    }      

    method setEnergiaMenor(valor){
        energiaMenor = valor
    }
}

pepe {
    method sosMenor(energiaMenor){
        pajarera.setEnergiaMenor(10)
    }
}

pepita {
    method sosMenor(energiaMenor){
        pajarera.setEnergiaMenor(25)
    }
}

formatter inlines named object instance variables

Ex:

object pepe {
    var menor = 100
    var pajaros = #[ pepita, pepe ]
}

produces

object pepe {
    var menor = 100 var pajaros = #[ pepita, pepe ]
}

Even worst when variables don't have any init values.

Null management on binary operations

The multiply operation has some null management logic which is not present in other operations, why is that?

@BinaryOperation('*')  
def Object multiplyOperation(Object a, Object b) { 
    if (a == null || b == null) null
    else multiply(a, b)
}

Should add this null-management-logic to every operation of the interpreter?

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.