Progress report: I have this line of code working:
world << contents.Copy().len That's pretty quick work, all things considered. Adapting the parser, the code generator, and a few other bits and pieces has been quite difficult. Interestingly this change doesn't particularly need to wait for 512 that I can see--that is, it involves no new instructions--but because it's a syntax change I'll be holding off on releasing it till 512 regardless. Next I'm gonna test if I can get this to work with assigning to a chained expression, and then I'll test with chaining from lists (which should work the same). |
With this accomplished, now I'm kinda wondering if something like Dart's .. operator would be worth pursuing.
|
In response to Lummox JR
|
|
Lummox JR wrote:
With this accomplished, now I'm kinda wondering if something like Dart's .. operator would be worth pursuing. If I read correctly it would be something like src Same as src.proc() src.proc()? |
My understanding of this, is that .. use is called a cascade.
Basically, the interpreter stores the last object that was called on. So: a.b() The .. operator stores the last object you called a method on so you can do sequential operations on an object without having to actually store it. This is useful for stuff like this: //list/l Whereas without this chaining, the structure would wind up having to be more like this: //list/l This is of course assuming you don't want to do an in-place copy of the list l via for(o in l) pattern. |
In response to Ter13
|
|
Ter13 wrote:
This looks like it would perform faster imo, hopefully it gets added, I can see the potential for it now. |
In response to Ter13
|
|
That's not exactly what the cascade "operator" does... at least, not in Dart.
https://www.dartlang.org/guides/language/ language-tour#cascade-notation- It uses the last reference before any cascades. a // a is to be used by the cascades. Your first snippet would actually do this: a.b() It's shorthand for making a variable initialized to the target expression to use it immediately: var foo/foo = a.b() |
While you're at it any chance for the ability to do this?
proc SpaceInsteadofSlashpls()
atm it produces
SpaceInsteadofSlashpls: undefined proc
|
Lummox JR resolved issue with message:
Proc calls and list reads can now be used in conjunction with the . or : operators. Since procs do not have such a thing as a return types and there is no such thing as a typed list, . and : behave identically in these cases. |
Is it wise to have the . operator behave the same as the : operator? In an analogous case, calling functions on proc return values, the . operator rightly throws a compile error, because the compiler does not know the type of the return value. But the : operator works, as it is meant for unsafe access. It seems to me that the semantics are the same: typed lists don't exist, so only the : operator should work.
|
Not a secret, I've documented this fact extensively over the years. =P (It's still a mess of nonsense though and I never tell people to use it)