-
Notifications
You must be signed in to change notification settings - Fork 16
Wollok v1.3 Confucius
Well-known objects can now inherit from classes which don't have a default constructor, and therefore require you to explicitly call a super constructor
We added several new static checks for errors and warnings that should really improve the experience working with Wollok. They should now catch errors sooner during coding instead of later in runtime with weird error messages and exceptions.
Similar to what the checker does to messages sent to "this", now it also validates messages to well-known objects (named objects, those defined with 'object x { ... }'
For some messages being sent Wollok can resolve them a particular methods. For the moment (without using the type system) those are:
- messages sent to this
- messages sent to super
- messages sent to well-known objects
In such a cases Wollok will now check if you are trying to use the return value of the message, and if it finds out that you are expecting a value but the method won't produce any value (doesn't have a return statement or uses the shorthand for methods returning a value) it will produce an error.
In this case "eat" doesn't return any valueThe checker now analyses the methods body and if they seems to be generating a value but the method is not returning it, it will raise a warning, since it is a common pitfall to forgot the return statement.
Now methods that have a return statement are analysed to make sure you are returning values on every possible flow.
In order to make it fun working in Wollok for more advanced developers we have added new quick fixes for static checks, which should improve development experience and speed.
For the new check of messages to WKO we provide a quick fix to create a new method. It currently only works for objects defined in the same file.
We have made some majors improvements to the Wollok IDE (meaning the more visual concerns).
Now you can navigate certain messages to methods with CTRL+click or F3
For the moment this only works for messages being sent to:
- this
- super()
- well-known objects
Resolving any message will require to have a type system.
The content assist now got more clever. It will propose you real messages you can send to:
- this
- well-known objects
Example messages to this
Messages to WKO
In case you are sending a message to any other object besides this and a WKO, it will only shows you the list of messages you already sent to that variable within the context. Which is the best we can do without a type system.
If you are trying to send a message to a parameter, then we will analyse other methods of the current class/object and if we find a parameter with the same name, we will propose you the same messages as the ones you are sending on that other method.
Here is an example:
The REPL console now has syntax highlighting. This is useful to differentiate the input lines from the output given by the wollok REPL (interpreter). It also highlights errors, and tries to highlight the input code you write in a similar way as the text editor (keywords, strings, variables, etc)
Part of the highlighting is actually done at the REPL size, so if you run the REPL from a console you will still see colors. Although not the full highlight as you will see in the Eclipse. Here is a sample with a bash console
There's a new button on the REPL console which allow you to export the current session as a wollok test. It doesn't export the whole history (which is longer than the current session), just the lines you just wrote on this session.
Here is a sample generated test