Re: BitArray new design - slice problems

2013-01-18 Thread Era Scarecrow
On Friday, 18 January 2013 at 16:42:04 UTC, Dmitry Olshansky wrote: Slices should have a pointer and length so they can check range (in debug builds), alternatively just a pointer to storage that nows the range. So write an alternate opIndex... I think slice ops could be made @safe if the pr

Re: How to use a function without their sources

2013-01-18 Thread Andrej Mitrovic
On 1/18/13, nazriel wrote: > There were 2 types of answers in this topic: > 1) Yes, you can if functions in library are marked as extern(C) You still have to provide .d or .di files, you can't expect the user to have to manually write extern declarations. > 2) Yes, you can even if functions are

Re: Pull 1019

2013-01-18 Thread Brad Roberts
On Fri, 18 Jan 2013, monarch_dodra wrote: > On Friday, 18 January 2013 at 18:35:47 UTC, Namespace wrote: > > Ok, thanks. > > But nobody can tell me when and if the "pull" is merged, right? > > I think many users here would be pleased if someone could say something to > > this pull. > > Not sure w

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 20:33:04 UTC, Andrej Mitrovic wrote: On 1/18/13, nazriel wrote: Show me a working solution to question from first post. "How to use existing static D library *WITHOUT* using .DI files". You can't edit library itself, so adding extern(C) to functions won't work.

Re: Pull 1019

2013-01-18 Thread Namespace
Not sure what you mean? Nobody will tell you when your pull fails the unittests. When your pull actually gets merged for real into the "head", you aren't notified either (sadly), but the puller usually leaves a "merged" comment, and you get *that* notification. It isn't my pull but I want to

Re: How to use a function without their sources

2013-01-18 Thread Andrej Mitrovic
On 1/18/13, nazriel wrote: > Show me a working solution to question from first post. > > "How to use existing static D library *WITHOUT* using .DI files". > You can't edit library itself, so adding extern(C) to functions > won't work. > You can't create .DI file - which is the main question from f

Re: How to use a function without their sources

2013-01-18 Thread anonymous
On Friday, 18 January 2013 at 17:47:42 UTC, nazriel wrote: lib.d: extern(C) void printf(const char*, ...); void foo() { printf("%s".ptr, "hi".ptr); } test.d: extern(C) void _D3lib3fooFZv(); void main() { _D3lib3fooFZv(); } On Friday, 18 January 2013 at 18:18:07 UTC, Andrej

Re: Pull 1019

2013-01-18 Thread monarch_dodra
On Friday, 18 January 2013 at 18:35:47 UTC, Namespace wrote: Ok, thanks. But nobody can tell me when and if the "pull" is merged, right? I think many users here would be pleased if someone could say something to this pull. Not sure what you mean? Nobody will tell you when your pull fails the

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:44:29 UTC, Andrej Mitrovic wrote: On 1/18/13, nazriel wrote: So don't take this serious. This is D.learn, so people expect to get valid information here and they don't know if you're showing an invalid example or not unless you tell them. It's valid examp

Re: How to use a function without their sources

2013-01-18 Thread Andrej Mitrovic
On 1/18/13, nazriel wrote: > So don't take this serious. This is D.learn, so people expect to get valid information here and they don't know if you're showing an invalid example or not unless you tell them.

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:34:24 UTC, Jordi Sayol wrote: Al 18/01/13 18:47, En/na nazriel ha escrit: On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interface? lib.d:

Re: Pull 1019

2013-01-18 Thread Namespace
Ok, thanks. But nobody can tell me when and if the "pull" is merged, right? I think many users here would be pleased if someone could say something to this pull.

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:23:57 UTC, nazriel wrote: On Friday, 18 January 2013 at 18:18:07 UTC, Andrej Mitrovic wrote: On 1/18/13, nazriel wrote: extern(C) void _D3lib3fooFZv(); void main() { _D3lib3fooFZv(); } That's a *terrible* idea, you are calling a D function using the

Re: How to use a function without their sources

2013-01-18 Thread Jordi Sayol
Al 18/01/13 18:47, En/na nazriel ha escrit: > On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: >> Is there a way to use a function from a static D library without importing >> their D sources nor their DI interface? > > lib.d: > > extern(C) void printf(const char*, ...); > > void

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:23:03 UTC, Johannes Pfau wrote: Am Fri, 18 Jan 2013 19:17:33 +0100 schrieb "nazriel" : [...] Nice! This should be mentioned at Language Reference, so it won't get lost. Isn't this documented? I thought it was well known that you can mark D functions as e

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:18:07 UTC, Andrej Mitrovic wrote: On 1/18/13, nazriel wrote: extern(C) void _D3lib3fooFZv(); void main() { _D3lib3fooFZv(); } That's a *terrible* idea, you are calling a D function using the C convention, you're going to have all sorts of problems.

Re: How to use a function without their sources

2013-01-18 Thread Johannes Pfau
Am Fri, 18 Jan 2013 19:17:33 +0100 schrieb "nazriel" : > [...] > > Nice! > This should be mentioned at Language Reference, so it won't get > lost. > Isn't this documented? I thought it was well known that you can mark D functions as extern(C). It's needed when implementing callback functions f

Re: How to use a function without their sources

2013-01-18 Thread Johannes Pfau
Am Fri, 18 Jan 2013 18:47:41 +0100 schrieb "nazriel" : > lib.d: > void foo() { > printf("%s".ptr, "hi".ptr); > } > > test.d: > extern(C) void _D3lib3fooFZv(); > I think this is dangerous, there's no guarantee that extern(D) equals extern(C). > How to handle name > mangling? > Maybe

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 18:10:35 UTC, Maxim Fomin wrote: On Friday, 18 January 2013 at 17:47:42 UTC, nazriel wrote: On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interf

Re: How to use a function without their sources

2013-01-18 Thread Andrej Mitrovic
On 1/18/13, nazriel wrote: > extern(C) void _D3lib3fooFZv(); > > void main() { > _D3lib3fooFZv(); > } That's a *terrible* idea, you are calling a D function using the C convention, you're going to have all sorts of problems. extern(D) is not just used for mangling, it's also used for design

Re: How to use a function without their sources

2013-01-18 Thread Maxim Fomin
On Friday, 18 January 2013 at 17:47:42 UTC, nazriel wrote: On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interface? lib.d: extern(C) void printf(const char*, ...); void fo

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 04:46:46 UTC, Andrej Mitrovic wrote: On 1/18/13, Rob T wrote: however I read somewhere that it pretty much does nothing but strip out the comments because it needs the full source code for a inlining, CTFE, and templates. There was a recent pull that implemente

Re: How to use a function without their sources

2013-01-18 Thread nazriel
On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interface? lib.d: extern(C) void printf(const char*, ...); void foo() { printf("%s".ptr, "hi".ptr); } test.d: exter

Re: How to use a function without their sources

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 17:02:51 UTC, Jordi Sayol wrote: Is there a way to use a function from a static D library without importing their D sources nor their DI interface? Yes you should be able to do it, but not everything can be imported without the source code, for example function te

How to use a function without their sources

2013-01-18 Thread Jordi Sayol
Is there a way to use a function from a static D library without importing their D sources nor their DI interface? -- Jordi Sayol

Re: BitArray new design - slice problems

2013-01-18 Thread Dmitry Olshansky
18-Jan-2013 01:49, Era Scarecrow пишет: On Thursday, 17 January 2013 at 19:36:34 UTC, Dmitry Olshansky wrote: I'm thinking that a opSlice of stack-allocated must be @system and a heap allocated can be @safe. That's just a small part of the problem. With the new design, 90% of it can be safe;

Re: extern (D)?

2013-01-18 Thread Johannes Pfau
Am Fri, 18 Jan 2013 01:07:05 + (UTC) schrieb Justin Whear : > > You can use "extern(D)" or simply "extern"; this is described here: > http://dlang.org/attribute.html#linkage > > Justin BTW: I wonder how export should be used? It seems like it currently does nothing (because we only use s

Re: Pull 1019

2013-01-18 Thread monarch_dodra
On Friday, 18 January 2013 at 13:13:03 UTC, Jacob Carlborg wrote: On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)? I'm still quite new with Git so I do not know exactly what "1

Re: Pull 1019

2013-01-18 Thread Jacob Carlborg
On 2013-01-18 14:07, Namespace wrote: Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)? I'm still quite new with Git so I do not know exactly what "1 Fail, 9 Pending" means (and why it stands there so long) It means

Pull 1019

2013-01-18 Thread Namespace
Despite the danger that this annoy you probably: What about pull 1019 (https://github.com/D-Programming-Language/dmd/pull/1019)? I'm still quite new with Git so I do not know exactly what "1 Fail, 9 Pending" means (and why it stands there so long) and how current the merge determination is. Bu

Re: extern (D)?

2013-01-18 Thread Jacob Carlborg
On 2013-01-18 09:09, Rob T wrote: I have not yet seen examples or documentation explaining how to separate interface and implementation from a class or struct. Are you sure this can be done? Yes, it's supposed to work. Just create a class as you normally would and compile it as a library. The

Re: extern (D)?

2013-01-18 Thread Simon
On 18/01/2013 08:09, Rob T wrote: On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote: You cannot both have CTFE/inlining/templates and hide the source code. It's the same as in C++. Yes I am aware of that limitation, nothing can be done except lose the flexibility of templates a

Re: extern (D)?

2013-01-18 Thread Rob T
On Friday, 18 January 2013 at 07:34:35 UTC, Jacob Carlborg wrote: You cannot both have CTFE/inlining/templates and hide the source code. It's the same as in C++. Yes I am aware of that limitation, nothing can be done except lose the flexibility of templates and so forth, or keep it and expo