Wow there are some real doozy inout code examples in there, showing
aliasing much more fun than my snippet. Unfortunately I can't
understand anything else the doc is talking about. I guess I'll just
say a prayer and throw salt over my shoulder if using inout.
On Sat, Jun 11, 2016 at 6:05 PM, Bre
I don't believe the (spartan) docs address this case:
func foo(inout a: [Int], inout b: Int) {
let acopy = a
a = [4, 5, 6]
print(acopy) // prints "[1, 2, 3]"
b = 99
print(a) // prints "[4, 5, 6]"
print(acopy) // prints "[1, 2, 99]" (e.g. a let variable changed!)
}
var
Having stack traces on critical faults is an "enterprisey" feature that I
like. It would be nice if swift allowed customization of what happened on
a trap (like array out of bounds), so it dumped the thread's stack trace to
stderr before exiting.
I can simulate the desired behavior by installing
an-inline-function
>
> - mish
>
> On Dec 10, 2015, at 8:23 AM, Karl Pickett via swift-users <
> swift-users@swift.org> wrote:
>
> Two use cases:
>
> 1. poking around in the asm for learning. Currently one can work around
> by putting funcs in different files
This code example:
if someInstance.dynamicType === someInstance.self {
print("The dynamic and static type of someInstance are the same")
} else {
print("The dynamic and static type of someInstance are different")
}
// prints "The dynamic and static type of someInstance are different”
Does
programmers
worried about speed and stack usage run away screaming, and not give swift
a try.
On Mon, Dec 7, 2015 at 11:53 AM, Joe Groff wrote:
>
> On Dec 6, 2015, at 5:16 PM, Karl Pickett via swift-users <
> swift-users@swift.org> wrote:
>
> I have a struct and thi
I have a struct and this code:
func test() {
precondition(sizeof(Foo) == 128)
let s = Foo()
for _ in 0..<100_000_000 {
doSomething(s)
}
}
The asm (on LInux, with -O) is showing me that s is being re-initialized on
every iteration of the loop. I was hoping that thanks to