Archive for April 5, 2014

Saturday, April 5, 2014

Roslyn: Microsoft’s Clang

Microsoft:

The .NET Compiler Platform (“Roslyn”) provides open-source C# and Visual Basic compilers with rich code analysis APIs. You can build code analysis tools with the same APIs that Microsoft is using to implement Visual Studio!

Jesper:

Roslyn was the codename of the effort to rebuild the C# and Visual Basic.NET compilers in their own languages, but also to do it in a modern way. These compilers expose services that are appropriate to the stages of compilation and allow the information that the compiler builds up not only not to go to waste but to be readily accessed by other programs. Instead of sitting on the knowledge, sharing it.

Searching Using fnd.io Instead of iTunes

Alex Heath:

Let’s be honest, searching in the iTunes Store sucks, especially on the desktop. It’s often slow, and the results are difficult to navigate. Apple has tried to simplify things by displaying one result at a time in the App Store on iOS, but that approach also means that it can take longer to find the specific app you want in a sea of knockoffs.

A new web tool called “fnd” makes it easier to quickly search and navigate not just the App Store, but the iTunes Store in general.

Unlike iTunes (and the Mac App Store), fnd.io is fast, and you can search and select text within the page. Here’s a LaunchBar search template for it:

https://fnd.io/#/search?mediaType=all&term=*

Adding ARC Code to a Project That Also Compiles for i386

Jeff Johnson:

The ARCHS build setting for your framework includes both i386 and x86_64. The first thing you'll want to do is to put your ARC code in files that aren't used by your 32-bit apps. Next, you'll want to wrap your ARC code files with #if __LP64__ to conditionally compile the code for 64-bit. As a consequence, the files will simply be empty when compiling i386. Finally, ARC can be enabled for individual files with the -fobjc-arc compiler flag. In Xcode, you can set per-file flags under Build Phases in the Compile Sources build phase. The catch, for “fat” or “universal” builds that are both 32- and 64-bit, is that you cannot set your per-file flags to -fobjc-arc. Why not? Because the per-file compiler flag applies to every architecture, but -fobjc-arc is an invalid flag for i386. So your build will die.

The trick to enabling ARC for specific files in your framework is to use a per-architecture build setting. Create a User-Defined build setting, something like MY_FRAMEWORK_USE_ARC. Make the build setting empty. Then create a per-architecture variant of MY_FRAMEWORK_USE_ARC for Intel 64-bit, and set that variant to -fobjc-arc. You'll now be able to use $MY_FRAMEWORK_USE_ARC as the per-file flag in your build phase, and the flag will have the appropriate definition as each architecture is built.

Also, when you’re in Xcode’s Compile Sources view, you can select multiple files and press Return to batch-edit the Compiler Flags.