Open nscarcella opened 5 years ago
Pongo en el tapete lo que discutimos hoy con @nscarcella :
vamos a arrancar con los validadores, haciendo que los tests de validación pasen a estar en wollok-language.
Tener en wollok-language los tests de xpect
test "Max between 5 and 8" {
@Validation("errors", "Duplicated Name", "a") <-- agregar la capacidad de un @ con cualquier cosa que después se procese
// XPECT errors --> "Duplicated Name" at "a"
const a = 3
const result = 5.max(a)
assert.equals(3, result)
}
Además deberíamos hacer que los archivos terminados en .xt se highlighteen en VSC (es fácil, solo hay que agregar una configuración). Creamos este issue para wollok-highlighter-vscode.
Hacer que ambas implementaciones metan annotations (requiere dos tickets en cada tecnología). Para eso
@native
@private // para ocultarlo de autocomplete
@ignore // para los tests
@deprecated
'@' + ID + "(" + literales + ")" // => debería quedar último
Cuando esté en wollok-ts, preprocesamos los archivos sin cambiarlos para que hagan
test "Max between 5 and 8" {
@Validation("errors", "Duplicated Name", "a") <-- agregar la capacidad de un @ con cualquier cosa que después se procese
const a = 3
const result = 5.max(a)
assert.equals(3, result)
}
En Wollok Xtend no vamos a hacer nada, solo ser capaces de procesar la sintaxis.
Conviven XPECT de wollok-xtext con annotations de wollok-ts.
After it came up in several discussions I think it would be a good idea to make an actual proposal for this and see if we can push this in for the next version.
Basically, we have a bunch of use cases for some form of metadata notation:
and Annotations could be a great fit for this.
A simple approach could use the following syntax:
Annotations would be applied to the next non-annotation entity or member and simply store the annotated name along with any annotated parameters in the node. This allows for easy to extend and easy to ignore handling.
We don't necessarily need to provide an interface to read annotations, as long as we can access them in the backend implementations, but if we do, we could add that logic to the
wre/mirror
package, in order to keep the interfaces clean.The main purpose for adding these would be to enrich the low-level definitions an allow a more standardized and cleaner cross-platform handling of many phases of the language. There would be no need to show annotations in class and should have no direct impact in the current syllabus and examples.
Once we agree on the general syntax and approach I can write some sanity tests for this to guide the implementation.