Comments (6)
Out of curiosity: why?
from ceylon-sdk.
For instance I'd like to be able to use addAll
to add the elements of some other List
or Iterable
to my MutableList
by writing lst1.addAll(lst2)
. If the parameter type is Element...
then I have to write something like lst1.addAll(lst2.sequence...)
or for (e in lst2) { lst1.add(e); }
. On the other hand I can easily change lst1.addAll(1, 2, 3)
to lst1.addAll{1, 2, 3}
. So I guess parameter type Iterable
is preferable here.
from ceylon-sdk.
Ok understood... although this makes me wonder if this is not something you want in most cases anyway. I mean what's the advantage of having variadic parameters now? Are there examples where you'd want them where passing an Iterable
or List
just doesn't make sense?
from ceylon-sdk.
Citing from @gavinking's comment ceylon/ceylon-spec#488 (comment) :
Sequenced parameters are now a much more special-purpose thing for cases where you don't expect to ever be receiving collections. Things like
log()
,format()
,assertTrue()
, etc.
from ceylon-sdk.
FTR there's a further (slightly obscure) case where sequenced parameters are useful: when you want to write a single method that can masquerade as a T(X)
, T(X,X)
, T(X,X,X)
, etc. This is a bit like JavaScript's arguments
array.
I think this will turn out to be very nice for some metaprogramming scenarios. For example, it seems to be a nice way to write interceptors.
from ceylon-sdk.
Done.
from ceylon-sdk.
Related Issues (20)
- http.server.Request.read() and "unterminated" strings HOT 1
- Ceylon logging should support loggers with class name HOT 1
- JavaList should throw IOOBE for bad indexes HOT 2
- change pattern for attributes in `ceylon.html` HOT 4
- Regex stickiness
- ceylon.test::parameters is unintuitive when test is wrapped in a class HOT 1
- ceylon.test::parameters is unintuitive when test is wrapped in a class
- make JavaMap, JavaSet, JavaList serializable
- JDK 9 adds SSLEngineResult.HandshakeStatus.NEED_UNWRAP_AGAIN
- Loading files from the classpath throws FileSystemNotFoundException
- Bad class file error using ceylon.file 1.3.4-SNAPSHOT
- ceylon.time.iso8601::parseDayOfMonth and parseDate fail for leap day HOT 5
- ceylon.time.Period compare and equals incompatible HOT 2
- ceylon.time.Period should be `Invertible` HOT 4
- Decimal == AnythingElse causes assertion failure HOT 3
- use 'new' enum style instead of old 'object' style HOT 3
- ceylon.time.Duration should satisfy Summable, Invertible, and Comparable
- assertThateException -> ExceptionAssert can't handle member exception classes
- promlem with parsing february 29 in leap year HOT 2
- ceylon test -F fails with AssertionError
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 ceylon-sdk.