[eclipse/golo-lang] 2f1dc7: Adds simple destructuring.

1 view
Skip to first unread message

GitHub

unread,
Jul 6, 2015, 10:10:53 AM7/6/15
to golo...@googlegroups.com
Branch: refs/heads/master
Home: https://github.com/eclipse/golo-lang
Commit: 2f1dc71787506edd45fa1d1242684cfbbb03b940
https://github.com/eclipse/golo-lang/commit/2f1dc71787506edd45fa1d1242684cfbbb03b940
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M src/main/golo/standard-augmentations.golo
M src/main/java/fr/insalyon/citi/golo/compiler/ParseTreeToGoloIrVisitor.java
A src/main/java/fr/insalyon/citi/golo/compiler/parser/ASTDestructuringAssignment.java
M src/main/java/fr/insalyon/citi/golo/doc/ModuleDocumentation.java
M src/main/java/gololang/AbstractRange.java
M src/main/java/gololang/GoloStruct.java
M src/main/java/gololang/LazyList.java
M src/main/java/gololang/Tuple.java
M src/main/jjtree/Golo.jjt

Log Message:
-----------
Adds simple destructuring.

Allows to destructure a object to assign to several values at the same
time. E.g.:

let a, b = [1, 2]
require(a == 1 and b == 2, "failed")

Any object with a `destruct` method returning a tuple can be used.
Vararg can be used as the last value, e.g.

let a, b... = [1, 2, 3, 4]
require(a == 1 and b == [2, 3, 4], "failed")

Some built-in objects and augmentation are added to be compliant.


Commit: 751eb073f20accc8965d2e0207dee6929a96d7b0
https://github.com/eclipse/golo-lang/commit/751eb073f20accc8965d2e0207dee6929a96d7b0
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M src/main/golo/standard-augmentations.golo
M src/main/java/fr/insalyon/citi/golo/compiler/ParseTreeToGoloIrVisitor.java
M src/main/java/fr/insalyon/citi/golo/compiler/parser/ASTDestructuringAssignment.java
M src/main/java/fr/insalyon/citi/golo/compiler/parser/ASTForEachLoop.java
M src/main/jjtree/Golo.jjt

Log Message:
-----------
Adds destructuring to foreach loops

allows constructs like

foreach key, value in map: entrySet() {
println(key)
println(value)
}

on any iterable, as long as values are destructurable.


Commit: 245518020acd22f6b5a52ccfc1241ae349834b85
https://github.com/eclipse/golo-lang/commit/245518020acd22f6b5a52ccfc1241ae349834b85
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M src/main/golo/standard-augmentations.golo
M src/main/java/fr/insalyon/citi/golo/compiler/JavaBytecodeUnionGenerator.java
M src/test/java/fr/insalyon/citi/golo/compiler/CompileAndRunTest.java
M src/test/java/fr/insalyon/citi/golo/internal/testing/TestUtils.java
A src/test/resources/for-execution/destruct.golo
M src/test/resources/for-execution/unions.golo

Log Message:
-----------
Adds destructuring to union types and collections

Makes unions with values destructurable, and move list augmentation to
collection augmentation.

Adds unit tests.

Also fix a bug in union hashcode, and adds a util method to ease tests.


Commit: 44b7356e46df978fbd17211144c4e369c16c2e7a
https://github.com/eclipse/golo-lang/commit/44b7356e46df978fbd17211144c4e369c16c2e7a
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M doc/augmentations.asciidoc
M doc/basics.asciidoc

Log Message:
-----------
Document destructuring


Commit: 948a48118b0152171bf18d6de9ed554dd61e4673
https://github.com/eclipse/golo-lang/commit/948a48118b0152171bf18d6de9ed554dd61e4673
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M src/test/java/fr/insalyon/citi/golo/compiler/CompileAndRunTest.java

Log Message:
-----------
Disable tests on bootstrap

since augmentations are not available at bootstrap, tests failed.


Commit: 6dae67286a2a5e3dc463e7dbaed7be98bb4c8c95
https://github.com/eclipse/golo-lang/commit/6dae67286a2a5e3dc463e7dbaed7be98bb4c8c95
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M doc/basics.asciidoc
M src/main/java/fr/insalyon/citi/golo/compiler/ParseTreeToGoloIrVisitor.java
M src/main/jjtree/Golo.jjt
M src/test/resources/for-execution/destruct.golo

Log Message:
-----------
Allows to destructure to already defined variables

Already defined variables can be assigned with destructuring. E.g.

var a, b = [1, 2] # a = 1, b = 2
a, b = [b, a] # a = 2, b = 1


Commit: a66f0cb1f5d68a3348a4f22d9ab749e7a2f7c4e9
https://github.com/eclipse/golo-lang/commit/a66f0cb1f5d68a3348a4f22d9ab749e7a2f7c4e9
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M src/main/java/gololang/AbstractRange.java
M src/main/java/gololang/Tuple.java

Log Message:
-----------
Adds javadoc and small refactor

Adds javadoc comments and refactor according to @jponge comments.
Also adds a tuple `toArray` method to ease constructs such as:

let add = |a, b| -> a + b
add: invoke(point: destruct(): toArray())


Commit: 37cb503ed087364ca9d3cb2b8a120d79423635ae
https://github.com/eclipse/golo-lang/commit/37cb503ed087364ca9d3cb2b8a120d79423635ae
Author: Yannick Loiseau <m...@yloiseau.net>
Date: 2015-07-06 (Mon, 06 Jul 2015)

Changed paths:
M doc/augmentations.asciidoc
M doc/basics.asciidoc
M src/main/golo/standard-augmentations.golo
M src/main/java/fr/insalyon/citi/golo/compiler/JavaBytecodeUnionGenerator.java
M src/main/java/fr/insalyon/citi/golo/compiler/ParseTreeToGoloIrVisitor.java
A src/main/java/fr/insalyon/citi/golo/compiler/parser/ASTDestructuringAssignment.java
M src/main/java/fr/insalyon/citi/golo/compiler/parser/ASTForEachLoop.java
M src/main/java/fr/insalyon/citi/golo/doc/ModuleDocumentation.java
M src/main/java/gololang/AbstractRange.java
M src/main/java/gololang/GoloStruct.java
M src/main/java/gololang/LazyList.java
M src/main/java/gololang/Tuple.java
M src/main/jjtree/Golo.jjt
M src/test/java/fr/insalyon/citi/golo/compiler/CompileAndRunTest.java
M src/test/java/fr/insalyon/citi/golo/internal/testing/TestUtils.java
A src/test/resources/for-execution/destruct.golo
M src/test/resources/for-execution/unions.golo

Log Message:
-----------
Merge pull request #289 from yloiseau/feature/simple-destruct

simple destructuring of values in affectations and foeach loops.


Compare: https://github.com/eclipse/golo-lang/compare/65a8fe2b62bf...37cb503ed087
Reply all
Reply to author
Forward
0 new messages