Skip to content

Conversation

@knikamo
Copy link
Collaborator

@knikamo knikamo commented May 28, 2017

Default field values
Default field values are assignments added at the top of the init-method during desugaring. Default field values does not work for the main class since the init method is not called. Tobias suggested that he would solve this. There is currently no logic to prevent circular references or other unwanted expressions.

Default parameters
For each default parameter in a function/method declaration a new function/method is added during desugaring. During typechecking all function/method calls are adjusted to call the function/method with correct number of arguments. Default parameters work as expected according to the tests we have added.

General
We have not done anything with error handling or error messages. For example the error message for wrong number of arguments is now a bit weird since a function/method not always expects a fixed number of arguments.

We have written a few tests for each feature, but probably they do not cover everything.

EliasC and others added 12 commits April 20, 2017 19:35
This commit allows using any type where an `unsafe` parameter is
expected, making `unsafe` the escape hatch for parametric
constructs. It is needed for the implementation of `bestow`.
…rapluu#789)

* Disallow silently capturing an active this as a passive reference

Before this commit, in an `active` class, you could use `this` to
access fields or (synchronously) call methods inside a closure.
Because the mode of `this` is `active`, which is safe, the mode of
the closure would allow it to be shared, leading to potential
data-races. This commit changes an `active` `this` to a `local`
variable if it is used for synchronous accesses. This forces the
`local` mode on a closure containing e.g. `this.foo()`.

There are also some improved error messages and a small check for
when a required `var` field is provided as a `val` field.

Fixes parapluu#781.

* Dumb down C-type name generation

For C readability reasons, when a mode was available for a class,
the C name would include the name (e.g.
`_enc__read_String_String_t`). This breaks having multiple views
of `this` in an active class, so this commit removes it (writing
`class` instead of the mode).
* Add range information to parsed nodes

This commit extends the source position to include the range of
positions of an Encore AST-node. Before, when parsing an expression,
e.g. `(2,3)`, we would only know where the expression began. Now we also
have information on where the expression ends (in this example 5
characters after the beginning).

This is not visible to the programmer in any way, but is integral for
the upcoming editor mode support.

* Refactoring
Reacted to @kikofernandez' comments from parapluu#790. All in all, 56 lines shorter!
* Added forward for future chain case

* Grouped common functions

* Added error message

* Added forward on preexisting future

* Clean up code

* Fixed and Added one testcase for preexisting future

* Temp commit, could be removed

* Generate id function

* Rebase and keep forward(arg) code comments

* Add minor fix

* Add minor fix

* Added forward on preexisting future

* Fixed forward(id(arg)) and removed commented codes

* Fixed general cases in Optimiser

* Clean up code

* Renamed function, removed bad codes, and added more testcases

* Revised new test, removed unsed error message

* Removed unused function

* Refactored code

* Changed to static future_chain, renamed function
This commit gets rid of a C-warning when the body of a loop does
not have the type `unit`. No test has been added, as warning
output cannot be tested.

Fixes parapluu#759.
This commit adds to the error message the position of a match
expression when no case matches. A test has been added.

Fixes parapluu#733.
* Adding Pedestrian simulation stress test. For configuration options, see src/tests/stress/pedsim/README.md

* Removed some unused methods, comments, general cleanup

* more cleanup

* used private method keyword to make a method private

* removed binary file

* removed big problem instances

* removed big problem instances

* Fixed dumb of by one in setup

* undid unintential change to Makefile

* Lifted number of time steps to become a parameter for the simulation

* Lots of small changes

* Changed an error message to make dave less sad

* removed binary file
* cast print

* fix printing intptr_t

* fix to decimal format
@knikamo knikamo force-pushed the defFieldValues_defParams branch from 028de29 to 2cc5f80 Compare June 1, 2017 08:50
@kikofernandez kikofernandez force-pushed the defFieldValues_defParams branch 2 times, most recently from aeee00e to 803118b Compare June 6, 2017 17:25
casperstr and others added 6 commits June 7, 2017 05:19
This commit has squashed the following commits into a single one

- removing pbcopy
- prepare for default values
- exprimenterar med seq väldigt nära nu
- default field parameters working with bugs
- do not desugar field without expression
- refactor. adding comments
- deacent looking
- adding basic test for default params
- moving to other class
- More tests
- testing expressions and adding out
- moving
- adding test for defaultParameters
- removing binary
- adding test for finalizer
- adding tests for multiple constructors
- myser lite
- funkar lite gran sådär
- chaning test
- working for functions
- testar lite
- got first part, (method decl) of default paramaters for methods
  working.  ie this.test1()
This commit has squashed the following commits:

- default params for methods fixed
- default params for function does not work
- default params for functions working
- added tests for default params
- string as default param in function fixed
- removed finalize- and multipleInits-tests
- default paramters for local functions fixed
- removed a comment
- added a test for object as default parameter
- edited test for object as default parameter
- added test for default field values in a class without an init method
- removed comment
- git fix
- default field values works for class without init
- removed files
- small fixes
This commit adds an implicit call to `init` at the beginning of
the `main` method. It also adds a restriction from defining a
constructor method in the `Main` class. "Why this madness?" I hear
you ask. This is to give field initialization a place to be
desugared into, while still keeping `main` as the starting point
of the program.
@kikofernandez kikofernandez force-pushed the defFieldValues_defParams branch from 803118b to 7268677 Compare June 7, 2017 03:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants