Comments (3)
Also, it would prevent the REPL to print non-interesting return values from "order methods" (i.e. where intention is to produce an effect rather than returning a alue).
I mean, if the method has no "return" then it has no return value, it will help both the repl and the type checker to be more helpful
from wollok.
Two questions about "mandatory"
mandatory states for "to return you must write the return keyword" or "all methods must have a return value" ?
I don't remember if our "type system" has a notion of "void"
from wollok.
mandatory states for "to return you must write the return keyword" or "all
methods must have a return value" ?The first one: "to return you must write the return keyword"
The objective is to be able to differenciate:
a) "procedures" or "orders", which are interesting because of its (side)
effects and not by their return value (or do not have one).
b) "functions" or "questions", which are interesting because of its return
value and should (or must) not have side effect.
Another possibility is to introduce a new keyword, instead of using
"method" for both cases. That was my first idea.
But now I think that using the return keyword would do the trick and has
other advantages:
-
Explicit returns are more clear for beginners.
As much as I like implicit return values for my own programmres, I have to
admit that it confuses some people. -
Explicit returns allow for more flow-control possibilities.
You can see that almost every language with implicit return values has also
the possibility of an explicit return instruction that allows to finish
current method.
The question is: Had we mandatory explicit returns for methods, should
blocks also have mandatory returns?
I do not know.
I don't remember if our "type system" has a notion of "void"
Maybe not... we could add it.
Anyway I was thinking not to use the type system this semester.
from wollok.
Related Issues (20)
- Al instalar Wollok en disco distinto a Java, no funciona. HOT 5
- Type system cont inherited clases problem parser order
- Herencia de mixins: se valida llamada a self erróneamente
- Inicialización con bloques explota
- Error Interno al ejecutar HOT 1
- wollok launcher quit unexpectedly on mac Catalina
- Replace: un remove seguido de un add
- Error al querer pedir el volumen de un sonido
- Error al importar arcihvos de subcarpetas, dentro de la carpeta src HOT 2
- NTH: Operadores ternarios HOT 2
- Error al intentar definir variables de un wko en base a referencias de una clase padre
- Que el onCollideDo no se ejecute muchas veces ante un error HOT 1
- Creating a `WOLLOK.ROOT` file doesn't work to me
- Wollok support for ARM Architecture
- Feature: Permitir cambiar la imagen de fondo una vez que ya fue seteada HOT 1
- Error al ejecutar el juego con el programa
- Error al ejecutar juego con el programa
- El comportamiento de `initialize` no se hereda
- Duda del uso de Wollok en Ubuntu HOT 3
- Compatibilidad con macOS basado en Apple Silicon y Wollok Game en maquinas virtuales ARM HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wollok.