One of the things I like about Objective-C is the use of infix arguments when calling a method.
[myDictionary setObject:myObject forKey:@"key"];
where the method name is setObject:forKey:
.
Does any other language do this?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityOne of the things I like about Objective-C is the use of infix arguments when calling a method.
[myDictionary setObject:myObject forKey:@"key"];
where the method name is setObject:forKey:
.
Does any other language do this?
Since Objective-C inherited its core object-oriented features (minus categories and protocols), including the syntax, from Smalltalk, there's obviously at least Smalltalk that has the same syntax. Plus, all of the Smalltalk descendants such as Self, Newspeak and Fancy.
foo:bar:
it would be calledfoo: 1 bar: 2
instead offoo:bar:(1, 2)
.