Re: D/Objective-C, extern (Objective-C)

2014-09-24 Thread Christian Schneider via Digitalmars-d-announce
I almost got Chocolate running on a 10.9.4 machine with all the latest developer tools (including Xcode 6), all built from source and 64 bit with the latest git checkouts (including phobos). Of course it is not within Xcode but using dub, so the biggest thing yet to do is to bundle an OSX app

Re: D/Objective-C, extern (Objective-C)

2014-09-24 Thread Jacob Carlborg via Digitalmars-d-announce
On 2014-09-24 14:56, Christian Schneider wrote: I almost got Chocolate running on a 10.9.4 machine with all the latest developer tools (including Xcode 6), all built from source and 64 bit with the latest git checkouts (including phobos). Of course it is not within Xcode but using dub, so the

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Sönke Ludwig
Am 24.06.2013 23:26, schrieb bearophile: Walter Bright: Yes, but since I don't know much about O-C programming, the feature should be labeled experimental until we're sure it's the right design. This change opens a new target of D development (well, it was already open for the people

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Sönke Ludwig
Am 24.06.2013 20:10, schrieb Brian Schott: On Monday, 24 June 2013 at 17:51:08 UTC, Walter Bright wrote: On 6/24/2013 3:04 AM, Jacob Carlborg wrote: On 2013-06-23 23:02, bearophile wrote: Instead of: extern (Objective-C) Is it better to use a naming more D-idiomatic? extern (Objective_C)

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Jacob Carlborg
On 2013-06-26 10:54, Sönke Ludwig wrote: I agree. Even though it may not be mentioned in books and many people may never see the changes, it still *does* make the language more complex. One consequence is that language processing tools (compilers, syntax highlighters etc.) get updated/written

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Sönke Ludwig
Am 26.06.2013 12:09, schrieb Jacob Carlborg: On 2013-06-26 10:54, Sönke Ludwig wrote: I agree. Even though it may not be mentioned in books and many people may never see the changes, it still *does* make the language more complex. One consequence is that language processing tools (compilers,

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Jacob Carlborg
On 2013-06-26 13:07, Sönke Ludwig wrote: I agree, it will only influence tools that include a parser. Few syntax highlighters parse the code (although *some* do), so this was probably not the best example. Absolutely, some even do semantic analyze. Example, the syntax highlighter in Eclipse

Re: D/Objective-C, extern (Objective-C)

2013-06-26 Thread Michel Fortin
On 2013-06-26 11:07:45 +, Sönke Ludwig slud...@outerproduct.org said: Naively I first thought that .class and .protocolof were candidates for __traits, but actually it looks like they might simply be implemented using a templated static property: class ObjcObject { static @property

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Johannes Pfau
Am Mon, 24 Jun 2013 22:30:56 +0200 schrieb Jacob Carlborg d...@me.com: On 2013-06-24 15:27, Michel Fortin wrote: Not necessarily. There's a couple of Objective-C classes that get special treatment by the compiler (identified by a pragma). One could do the same for an UDA so the compiler

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Jacob Carlborg
On 2013-06-25 08:53, Johannes Pfau wrote: Maybe it's new in dmd but gdc already has an UDA which is recognized by the compiler: https://github.com/D-Programming-GDC/GDC/blob/master/libphobos/libdruntime/gcc/attribute.d

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Jacob Carlborg
On 2013-06-25 00:39, Steven Schveighoffer wrote: I think this is largely false. In order for the new syntax to be valid, you must use extern(Objective-C). That would be quite an accident. Consider that I have never dealt with the COM compatibility (or frankly, even the extern(C++)

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Paulo Pinto
On Monday, 24 June 2013 at 22:39:13 UTC, Steven Schveighoffer wrote: On Mon, 24 Jun 2013 18:10:19 -0400, bearophile bearophileh...@lycos.com wrote: Jacob Carlborg: I don't think it adds much complexity. If you don't use extern (Objective-C) you don't need to learn it. D books must be

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Walter Bright
On 6/24/2013 1:18 PM, Michel Fortin wrote: And I don't think it is very common in D either. Either way, if D was to implement ARC for its own memory allocator instead of the current GC (which would be great) there's noting to prevent implementing it so that reference counts could be incremented

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Michel Fortin
On 2013-06-25 18:06:33 +, Walter Bright newshou...@digitalmars.com said: On 6/24/2013 1:18 PM, Michel Fortin wrote: And I don't think it is very common in D either. Either way, if D was to implement ARC for its own memory allocator instead of the current GC (which would be great) there's

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Jacob Carlborg
On 2013-06-25 20:06, Walter Bright wrote: 3. migrating non-ARC code to ARC is error-prone and a major nuisance Xcode provides refactoring tools to migrate manual reference counting and GC code to ARC. 4. non-O-C programs can also benefit from ARC (after all, reliance on the GC is the

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Walter Bright
On 6/25/2013 1:08 PM, Jacob Carlborg wrote: On 2013-06-25 20:06, Walter Bright wrote: 3. migrating non-ARC code to ARC is error-prone and a major nuisance Xcode provides refactoring tools to migrate manual reference counting and GC code to ARC. Those don't work with D. Let's do it right

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Jacob Carlborg
On 2013-06-25 22:18, Walter Bright wrote: Those don't work with D. Let's do it right the first time, and we won't have migration issues. Right, forgot to add: for Objective-C. -- /Jacob Carlborg

Re: D/Objective-C, extern (Objective-C)

2013-06-25 Thread Manu
On 26 June 2013 04:06, Walter Bright newshou...@digitalmars.com wrote: On 6/24/2013 1:18 PM, Michel Fortin wrote: And I don't think it is very common in D either. Either way, if D was to implement ARC for its own memory allocator instead of the current GC (which would be great) there's

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Jacob Carlborg
On 2013-06-23 23:02, bearophile wrote: Instead of: extern (Objective-C) Is it better to use a naming more D-idiomatic? extern (Objective_C) As Simen said, we already have extern (C++). But I can absolutely change this if people wants to. Regarding this syntax: void

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Jacob Carlborg
On 2013-06-23 23:12, Walter Bright wrote: Thank you for reviving this. Please carry on! Is there a chance we can get this into main line? -- /Jacob Carlborg

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Michel Fortin
On 2013-06-23 20:24:41 +, Jacob Carlborg d...@me.com said: As some of you might know Michel Fortin created a fork of DMD a couple of years ago which add support for using Objective-C classes and calling Objective-C method. That is making D ABI compatible with Objective-C. I have now

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Michel Fortin
On 2013-06-24 10:04:01 +, Jacob Carlborg d...@me.com said: Regarding this syntax: void insertItem(ObjcObject object, NSInteger value) [insertItemWithObjectValue:atIndex:]; Is it possible and good to replace it with some UDA? We could use an attribute. But I don't think it would be

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 3:04 AM, Jacob Carlborg wrote: On 2013-06-23 23:12, Walter Bright wrote: Thank you for reviving this. Please carry on! Is there a chance we can get this into main line? Yes, but since I don't know much about O-C programming, the feature should be labeled experimental until

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 6:27 AM, Michel Fortin wrote: Finally, there is a couple of features that were added to Objective-C since then that should be added to the todo list to keep feature parity. Some of those, if implemented right, could benefit the rest of D too. For instance: ARC (automatic reference

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Adam D. Ruppe
On Monday, 24 June 2013 at 17:53:36 UTC, Walter Bright wrote: Arc has very serious problems - I don't see how it can be done and be memory safe without adding extensive pointer annotations. The general problem is someone taking the address of a member of the reference counted object. The rc

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Brian Schott
On Monday, 24 June 2013 at 17:51:08 UTC, Walter Bright wrote: On 6/24/2013 3:04 AM, Jacob Carlborg wrote: On 2013-06-23 23:02, bearophile wrote: Instead of: extern (Objective-C) Is it better to use a naming more D-idiomatic? extern (Objective_C) As Simen said, we already have extern

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 11:03 AM, Steven Schveighoffer wrote: All data members in Objective-C are private. So the object can control when it gives out this data, and take appropriate actions. AFAIK, ARC does not worry about internal pointers. Hmm, that's a good thought. (But recall that modules allow

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Steven Schveighoffer
On Mon, 24 Jun 2013 14:25:40 -0400, Walter Bright newshou...@digitalmars.com wrote: On 6/24/2013 11:03 AM, Steven Schveighoffer wrote: All data members in Objective-C are private. So the object can control when it gives out this data, and take appropriate actions. AFAIK, ARC does not

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Michel Fortin
On 2013-06-24 17:53:40 +, Walter Bright newshou...@digitalmars.com said: On 6/24/2013 6:27 AM, Michel Fortin wrote: Finally, there is a couple of features that were added to Objective-C since then that should be added to the todo list to keep feature parity. Some of those, if implemented

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 1:18 PM, Michel Fortin wrote: That's not a so big problem: just disallow taking pointers to member variables inside of reference-counted memory blocks. At least in SafeD. This is a quite rare thing to do in Objective-C anyway, I'd be surprised if it bothered anyone. And I don't

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Jacob Carlborg
On 2013-06-24 15:27, Michel Fortin wrote: Not necessarily. There's a couple of Objective-C classes that get special treatment by the compiler (identified by a pragma). One could do the same for an UDA so the compiler would know where to get that value. I'd surely have implemented it as an UDA

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Suliman
Could anybody explain the practical side of this project? Where it can be helpful?

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Jacob Carlborg
On 2013-06-24 19:36, Walter Bright wrote: Yes, but since I don't know much about O-C programming, the feature should be labeled experimental until we're sure it's the right design. Absolutely. But there's not that much to design. It's the same with extern (C) nothing to design there, just

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Steven Schveighoffer
On Mon, 24 Jun 2013 16:36:50 -0400, Suliman everm...@live.ru wrote: Could anybody explain the practical side of this project? Where it can be helpful? First, you should quote the bit of the post that you are responding to. Since you responded to my post, I will answer. Objective C is

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 1:37 PM, Jacob Carlborg wrote: On 2013-06-24 19:36, Walter Bright wrote: Yes, but since I don't know much about O-C programming, the feature should be labeled experimental until we're sure it's the right design. Absolutely. But there's not that much to design. It's the same with

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Jacob Carlborg
On 2013-06-24 22:49, Walter Bright wrote: The difference is I know C intimately. Fair enough. Please ask any questions and we will try and answer. I did read it. Great. -- /Jacob Carlborg

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread bearophile
Walter Bright: Yes, but since I don't know much about O-C programming, the feature should be labeled experimental until we're sure it's the right design. This change opens a new target of D development (well, it was already open for the people willing to use a not standard dmd compiler),

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Walter Bright
On 6/24/2013 1:45 PM, Steven Schveighoffer wrote: On Mon, 24 Jun 2013 16:36:50 -0400, Suliman everm...@live.ru wrote: Could anybody explain the practical side of this project? Where it can be helpful? First, you should quote the bit of the post that you are responding to. Since you

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread bearophile
Jacob Carlborg: I don't think it adds much complexity. If you don't use extern (Objective-C) you don't need to learn it. D books must be bigger, D programmers must read those parts of the books, the error messages become more complex (because you can hit by mistake the unwanted syntax, or

Re: D/Objective-C, extern (Objective-C)

2013-06-24 Thread Steven Schveighoffer
On Mon, 24 Jun 2013 18:10:19 -0400, bearophile bearophileh...@lycos.com wrote: Jacob Carlborg: I don't think it adds much complexity. If you don't use extern (Objective-C) you don't need to learn it. D books must be bigger, D programmers must read those parts of the books, the error

Re: D/Objective-C, extern (Objective-C)

2013-06-23 Thread bearophile
Jacob Carlborg: http://michelf.ca/projects/d-objc/syntax/ Instead of: extern (Objective-C) Is it better to use a naming more D-idiomatic? extern (Objective_C) Regarding this syntax: void insertItem(ObjcObject object, NSInteger value) [insertItemWithObjectValue:atIndex:]; Is it

Re: D/Objective-C, extern (Objective-C)

2013-06-23 Thread Simen Kjaeraas
On 2013-06-23, 23:02, bearophile wrote: Jacob Carlborg: http://michelf.ca/projects/d-objc/syntax/ Instead of: extern (Objective-C) Is it better to use a naming more D-idiomatic? extern (Objective_C) There's already some precedence in extern (C++). -- Simen