mikeash / macollectionutilities Goto Github PK
View Code? Open in Web Editor NEWSmalltalk-inspired collection utility methods and macros for Cocoa
License: Other
Smalltalk-inspired collection utility methods and macros for Cocoa
License: Other
Please add a tag to the most recent commit, so I can update the CocoaPod podspec file to point to it.
Seems there is a bug in the CocoaPods trunk push command, that doesn't let me update the pod, even though I use the --allow-warnings
option.
ilja$ pod trunk push --allow-warnings
[!] Found podspec `MACollectionUtilities.podspec.json`
Validating podspec
-> MACollectionUtilities (0.1.0)
- WARN | [source] Git sources should specify a tag.
[!] The Pod Specification did not pass validation.
Seems Apple deliberately removed NSMapTable from the iOS platform, even if they use it internally.
(http://seriot.ch/resources/dynamic_iPhone_headers/4/MKOverlayContainerView.h)
Any chance you provide a version that uses NSDictionary or some other class that's available from iOS?
Thanks,
Peter
A SORTED
macro would reduce the verbosity of doing custom collection sorts:
a = SORTED(b, [a compare: b options: NSCaseInsensitiveSearch | NSNumericSearch]);
As a bonus, it could be made to work on sets/dictionaries, returning a sorted array of their contents.
The DICT macro is never able to create a dictionary because a segmentation fault occurs in the static inlined function "MADictionaryWithKeysAndObjects". The compound literal (array of objects) keysAndObjs' elements points to objects on the heap that are no longer valid when that function attempts to subscript the array.
After a bit of investigation I found that if I made the "MADictionaryWithKeysAndObjects" a normal function that is not inlined the keysAndObjs array pointed to valid objects and the macro worked. I ensured that the compiler didn't optimize the MADictionaryWithKeysAndObjects into an inlined function by stepping through the assembly and ensuring that it used "call" instead of "jmp".
Oddly, it appears that the elements of keysAndObjs are being prematurely deallocated when MADictionaryWithKeysAndObjects is inlined. However, what is stranger, is that my dictionary contained a set of string literals as key/values which would make me think that those objects couldn't be deallocated anyhow since they are global strings.
This was happening consistently on the iOS Simulator 4.2 with both GCC 4.2 and LLVM GCC 4.2.
Code Snippet:
DICT(@"A", @"B", @"C", @"D");
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.