Comments (8)
This will be interesting if it'll be compatible with function return.
some: func -> (Int, Int, Int) { return (1, 2, 3) } (a, b, c) := some()
And as usual, the notation of the type of returned value could be shortened in "-> Int" in case of same type for the n.
There's tons of possible examples.
One ramdomly picked and a bit stupid : a function that diagonalize a matrix and return the diagonalized matrix and the base changement matrix.
(excuse my english math...)
from rock.
Yes, yes that's definitely the spirit. We need an ORC on that.
from rock.
So it would be like tuples in other languages? As in immutable arrays?
from rock.
Well, even if they're only used in 1) assignment and 2) function retuns, they would still be pretty useful. Having them as a real data-type isn't really needed imho, we have arrays for that.
from rock.
Using multi-assignment for swapping values would be nice too:
(a, b) = (b, a)
How cool is that?
from rock.
It's cool, but is it needed? Where is that ever really necessary?
from rock.
Where is it ever necessary? Well, not that often, but often enough to justify it.
Turns out, it's really really easy to implement now that nagaqueen parses tuples and that rock has an AST node for it anyway. Just a matter of matching the left and right arguments, and creating a temp variable if needed.
A child could do it. Anyone wanna give it a try or do you prefer if I handle it?
from rock.
Fully implemented multi-assign. Closed by f1ecc49
from rock.
Related Issues (20)
- pkg-config/CustomPkg flags aren't passed to additionals HOT 2
- Rock cannot find sdk when run from make HOT 2
- Weird behaviour with setters calling associated getter HOT 7
- The way rock constructs class information can lead to data races in seemingly unrelated code HOT 3
- Unexpectedly "good" behaviour from ooc arrays HOT 4
- So, is OOC development still onging? HOT 5
- Rock aborts with interfaces HOT 1
- Problems making after cloning repo HOT 4
- Problem installing: GC_jmp_buf multiple definition HOT 2
- The top 5 bugs? HOT 3
- Template type instances generated in separate modules do not generate include statements in C code HOT 1
- Wrong cast to non scalar type, and some other problems. HOT 3
- Rock parses function arguments with default values incorrectly HOT 1
- 'this' as default parameter value in a function refers to the wrong object HOT 2
- Static variables are not maintained correctly HOT 4
- Add newcomer label to issues HOT 1
- Allow implementing interfaces after type declaration HOT 1
- rock generates invalid C code when trying to access an interface's generic type HOT 2
- Funcs should behave as Closures with extra type information. HOT 7
- rock sometimes segfaults when classes try to implement interfaces
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 rock.