Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
In this case, Joe and I literally had that conversation in the public Swift JIRA instance. :shrug:

Adbot
ADBOT LOVES YOU

HaB
Jan 5, 2001

What are the odds?
Since I am obsessive about having no warnings at all, how do I solve this one?:

code:
for var c in rowsColumns.characters {  // 
warns with: variable c was never mutated, consider changing to let

but if I do that, I get:

let pattern cannot appear nested in an already immutable context

Edit: here's the entire func:

code:
func generateTable(key: String) {
        let preparedKey = stripDupes(key)
        if(preparedKey.characters.count >= 5) {
            let rowsColumns = completeLetterSet(preparedKey)
            var alphabet = completeLetterSet(preparedKey).reverse()
            for var c in rowsColumns.characters {
                var idx = alphabet.startIndex
                var row = [Character: Character]()
            
                for var r in rowsColumns.characters {
                    row.updateValue(alphabet.characters[idx], forKey: r)
                    //print("col: \(c), row: \(r) = \(alphabet.characters[idx])")
                    idx = idx.advancedBy(1)
                }
                table.updateValue(row, forKey: c)
                alphabet.rotateLeft()
            }
        }
        else {
            // TODO: handle error for too short key
        }
    }

dizzywhip
Dec 23, 2005

If you leave off the var, it will implicitly be a constant: for c in rowsColumns.characters

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Wait what. Value type Foundation-equivalents weren't announced before just now, were they? (The Date/DateComponents/etc stuff?)

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
That went through the standard swift-evolution process and has been in the preview toolchain builds.

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
Yup, all the Swift 3 stuff has been part of the normal process.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer
Yeah I found the proposal. I don't know how I missed it.

TheReverend
Jun 21, 2005

Am I doing something dumb? Why is String.hash returning Int? Shouldn't it be UInt?

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

TheReverend posted:

Am I doing something dumb? Why is String.hash returning Int? Shouldn't it be UInt?

Pretty sure that's because Swift imports NSUInteger as Int.

Rudest Buddhist
May 26, 2005

You only lose what you cling to, bitch.
Fun Shoe
Hey Swift Gang. I've been working as an automation engineer for the last five years but over the last few months I've fallen in love with iOS development with swift. I have a few projects up on github and a app in the store. What are some things I could learn to set myself apart from the pack when I start interviewing for a proper swift / iOS position in the next month or two?

I can provide a resume and github over PM. Don't really want to out myself in this thread.

Kallikrates
Jul 7, 2002
Pro Lurker
Experience using different frameworks and their quirks is what really sets someone apart. Hard to cram for that though. Having stuff on github is a good first step.

One thing I see is that even though Swift is getting pretty prevalent, architecture questions I see still focus on patterns that are more heavily used in Obj-c. Maybe checking some obj-c design patterns (look for acronyms like KVO/KVC/Delegation etc)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Start interviewing now, learn up on whatever you encounter.

Rudest Buddhist
May 26, 2005

You only lose what you cling to, bitch.
Fun Shoe
Thanks for the advice!

I'm going to run through The Big Nerd Ranch Objective-C book over the next couple of days so I can familiarize myself with some of the older patterns and understand obj-c code a bit better. Then I'll start tossing the resume out and get into it.

toiletbrush
May 17, 2010
I'm trying to build a tiny new Swift 3.0 MacOS app to profile and I'm getting a compiler error...it builds fine without warning running it generally but as soon as I build for profiling I get the following error...

code:
inlinable function call in a function with debug info must have a !dbg location
  %10 = call %swift.type* @_TMaC12TinyRenderer9GameScene() #1
LLVM ERROR: Broken function found, compilation aborted!
Is this a bug or am I doing something stupid? I've tried cleaning etc but no joy :(

Edit to add: I've deleted code all the way down to just the ViewController stub you get for SpriteKit apps and I still get the error

toiletbrush fucked around with this message at 22:25 on Jul 5, 2016

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
That's not a really an error; it's a compiler crash that printed a relatively nice-looking diagnostic before aborting. Anyway, I recognize that one, and while I can't remember if there's a workaround, It should be fixed in the next beta.

HaB
Jan 5, 2001

What are the odds?
This may not be the most correct place to ask, but stack overflow and google in general have failed me.

For iOS 9.2 > with the multitasking stuff came a new public property on AVPlayerViewController - allowsPictureInPicturePlayback which does just what it sounds like.

What I need to know is - since that is now a public property - is there a way to turn it on/off from Javascript?

Like - a way to pass parameters to the play as you're playing a video, from an html player, for example.

I am able to listen for webkitpresentationmodechanged to grab webkitPresentationMode which returns a value of 'picture-in-picture' but disabling the event bubble from there is causing the page to freeze after you exit fullscreen.

If possible, I'd rather just hide the PiP button altogether.

TIA

Simulated
Sep 28, 2001
Lowtax giveth, and Lowtax taketh away.
College Slice
So Matt Gallagher makes an interesting argument that Swift's type constraint system solver can be made linear time instead of exponential, eliminating the stupid "expression too complex to type check" error.

http://www.cocoawithlove.com/blog/2016/07/12/type-checker-issues.html

He freely admits that he isn't qualified to say whether his proposed solution is good enough or has fatal flaws. Frankly I'm not qualified to make that judgement either. I was hoping rjmccall or someone else with compiler type system experience could shed some light?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Ender.uNF posted:

So Matt Gallagher makes an interesting argument that Swift's type constraint system solver can be made linear time instead of exponential, eliminating the stupid "expression too complex to type check" error.

http://www.cocoawithlove.com/blog/2016/07/12/type-checker-issues.html

He freely admits that he isn't qualified to say whether his proposed solution is good enough or has fatal flaws. Frankly I'm not qualified to make that judgement either. I was hoping rjmccall or someone else with compiler type system experience could shed some light?

That's my post that he links near the end. Exponential worst-case behavior is inherent to the type system, but I'm not sure how he gets from there to the idea that the compiler team isn't interested in type-checker improvements, since my post actually mentions at least one type-checker improvement that I implemented as part of my analysis (and there were several others).

As for concrete feedback, his algorithm isn't really an algorithm. Phase 1 in particular "eliminates" type variables by building arbitrarily complex types apparently defined by arbitrarily complex compound, nested constraints. The other idea, merging disjunctions, is a good one and, in fact, one we've already considered and would like to try. The problem is that we just haven't had the time to flesh it out because, unfortunately, the people who most understand the type checker are senior engineers with a lot of other responsibilities, like managing the team or making sure other features get implemented. We've recently brought in another engineer to work on it, but honestly I'm not even sure the expression type-checker is our first priority, because there's a lot of lost performance in other parts of semantic analysis.

Toady
Jan 12, 2009

I thought default public non-subclassability was sensible, but apparently bureaucratic forces are just restricting my freedom without reason or purpose. I'm grateful that people on the mailing list have opened my eyes.

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

Toady posted:

I thought default public non-subclassability was sensible, but apparently bureaucratic forces are just restricting my freedom without reason or purpose. I'm grateful that people on the mailing list have opened my eyes.

That dude is really starting to tick me off, and I don't mind saying so in a public forum.

emoji
Jun 4, 2004
If it's who I think you're talking about and their name rhymes with poo I met this person at a local Swift meetup and they are ...rather passionate.

Gul Banana
Nov 28, 2003

it's a very strange thing to get het up about, since unless you actually *forbid* nonvirtual methods people who care about api design will still be designing their inheritance contracts accordingly.

Doh004
Apr 22, 2007

Mmmmm Donuts...
Would have been better off not open sourcing the language.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"
The guy I'm thinking of (not rhymes-with-poo guy) is the one who goes only by his first initial and last name. I think I've seen him make one constructive post in the few months I've been following swift-evolution. Everything else is just meandering word salad that I can't even begin to parse and I don't think it's just a language barrier/non-native speaker problem. Someone should write a proposal banning him. :v:

I don't see why everyone is so up in arms about sealed-by-default classes anyway. You already can't subclass value types, and I've found myself writing way more of those than class types nowadays. And the class types I *do* write tend to be just because I need reference semantics and I make them final anyway. People complaining that they need to be able to subclass to "fix bugs" are poo poo out of luck if they have a struct, and that's a terrible justification/use for inheritance anyway. I'm glad the core team feels really strongly about this one so it doesn't get derailed.

No matter, I'm just glad my proposal finally got accepted!

lord funk
Feb 16, 2004

Flobbster posted:

And the class types I *do* write tend to be just because I need reference semantics and I make them final anyway.

Just jumping in without any knowledge of the discussion, but final is so much more performative I'm not surprised at sealed-by-default.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Flobbster posted:

I don't see why everyone is so up in arms about sealed-by-default classes anyway. You already can't subclass value types, and I've found myself writing way more of those than class types nowadays. And the class types I *do* write tend to be just because I need reference semantics and I make them final anyway. People complaining that they need to be able to subclass to "fix bugs" are poo poo out of luck if they have a struct, and that's a terrible justification/use for inheritance anyway. I'm glad the core team feels really strongly about this one so it doesn't get derailed.
AFAICT most of the people opposed to it don't actually use Swift and only care about what happens to Swift because they assume they'll be forced to use it in the future, so they won't have noticed that sort of thing.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

rjmccall posted:

That dude is really starting to tick me off, and I don't mind saying so in a public forum.

I have reservations about the proposal, but, man, he's so irritating I almost wanted it to get approved out of spite.

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Plorkyeran posted:

AFAICT most of the people opposed to it don't actually use Swift and only care about what happens to Swift because they assume they'll be forced to use it in the future, so they won't have noticed that sort of thing.

This explanation is one I've heard brought up in conversation before and it would make a ton of sense. It seems like there's a decent number of community members who are using the project as a vanity-contribution opportunity where they can argue about aesthetics, despite not really using the language.

sarehu
Apr 20, 2007

(call/cc call/cc)
One of the reasons that's a read-only mailing list for me. You've got to have skin in the game.

dc3k
Feb 18, 2003

what.
So I have some aliases in ~/.lldbinit that work fine. However, when I run them automatically on app-launch via a breakpoint, they spit out errors complaining about @ preceding strings and whatnot.

Why is this and how do I fix it :[

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
Guess: trying to run objc in a swift context. Try sticking some -l objc++ after your command (e.g. expr -l objc++).

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
Well, here goes Round 4. 3? 6? I can no longer recall what sort of time it was before I wandered this desert.

dc3k
Feb 18, 2003

what.

pokeyman posted:

Guess: trying to run objc in a swift context. Try sticking some -l objc++ after your command (e.g. expr -l objc++).

I'll give that a shot tomorrow.

It's weird though that it would complain when using the exact same command in the exact same place. If I hit my breakpoint and manually type poo poo in, it works. :confused:

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

rjmccall posted:

Well, here goes Round 4. 3? 6? I can no longer recall what sort of time it was before I wandered this desert.

Oh man, how was that "over two and a half hours" of nerd-talking about semantics?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

ultramiraculous posted:

Oh man, how was that "over two and a half hours" of nerd-talking about semantics?

It was Wednesday.

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

Toady posted:

I thought default public non-subclassability was sensible, but apparently bureaucratic forces are just restricting my freedom without reason or purpose. I'm grateful that people on the mailing list have opened my eyes.

For those of us who don't have the time to follow the mailing list, can someone elaborate on what's going on here?

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
I linked the latest proposal.

The idea is that making a class public shouldn't by itself allow it to be subclassed externally, and making a method public shouldn't by itself allow it to be overridden externally. Those should be additional, opt-in capabilities. In an earlier proposal, we suggested calling this "public open"; now we're just suggesting "open" so that it's more of an even alternative. None of this will impact Cocoa; everything from ObjC will still be considered open by default.

The basic breakdown is that library authors really like it, but other people are worried that they won't be able to get their work done (at least the way they're used to) because libraries will be too locked down, and some in the second camp are really over-the-top about it.

Echo Video
Jan 17, 2004

Also people saying how "but this is how we work around bugs in apple's frameworks, we'll be totally stumped without this" miss that
- Apple will do this anyway, even if it's not the language default
- you already can't do it with structs
- they aren't as smart as they think they are and poo poo will break

Axiem
Oct 19, 2005

I want to leave my mind blank, but I'm terrified of what will happen if I do

rjmccall posted:

I linked the latest proposal.

That's what I get for leaving the thread open for several hours and replying without refreshing :downs:

Though I always did think the "subclass it and change it to break it further until it works again" was a bad pattern, so I think this is a good change. But I also tend to prefer using the lower-level frameworks whenever possible, instead of the higher-level frameworks that seem to need "fixing" more often.

Adbot
ADBOT LOVES YOU

Gul Banana
Nov 28, 2003

man, "public open" made way more sense than the accessibility default magically changing when you un-final the type :/

  • Locked thread