Re: Server downtime
Am 28.08.2012 00:53, schrieb Walter Bright: Jan Knepper is going to be upgrading the digitalmars server to new hardware over the next couple days. This will result in some downtime. Is this only related to the digitalmars website or to this newsgroup, too?
Re: First working Win64 program!
yeha :-) +1
Re: import libzmq_d.dll for zmq3.2.0
I'm not a windows user but since nobody has answered yet, I'll give you my 50 cents. It requires a reference _zmq_version while the original function is called zmq_version. You'll need some kind of linker file. But don't quote me on that!
A successful Git branching model
Have you seen this? What do you think of it? Maybe we'll use this model in our company in nearest future. http://nvie.com/posts/a-successful-git-branching-model/
Re: deimos libX11 undefined reference
Am 12.07.2012 08:17, schrieb Jacob Carlborg: On 2012-07-12 01:50, cal wrote: Hmm, looking at the .c header, the function is not even defined. I think it is not used, and in this case turning macros into functions in the binding generates linker errors. I don't know the best way to fix this in the binding (I have simply commented out the functions in my repo, as they don't seem to be used). But its worth noting. If a macro is turned into a function it needs to have an implementation. when marcos are turned into functions they introduce new symbols. it's a pity, but in that case you have to link to deimos. so deimos will become a wrapper rather than a binding.
Re: Congratulations to the D Team!
Great work!!! Thanks guys!
Re: why is string not implicit convertable to const(char*) ?
Your answers are remarkable elaborated. Thanks for your great effort, Jonathan!! ;-)
why is string not implicit convertable to const(char*) ?
does anyone know why string not implicit convertable to const(char*) ? --- import core.sys.posix.unistd; void main() { // ok unlink(foo.txt); // failed string file = bar.txt; unlink(file); } test.d(10): Error: function core.sys.posix.unistd.unlink (const(char*)) is not callable using argument types (string) test.d(10): Error: cannot implicitly convert expression (file) of type string to const(char*)
Re: dlang.org live examples
Am 25.06.2012 22:25, schrieb nazriel: If you want to know more details, let me know Oh cool. That's great! textarea - JSON - AJAX - PHP Script - ... - Load Balancer - Chroot jail - D Compiler. How do you perform interation between php and you load balancer?
Re: dlang.org live examples
That's crazy shit yeha xD... and php and load balancer do communication via TCP/UNIX socket? some kind of protocol?
Re: dlang.org live examples
Hey, that's quite cool what you did! how did you do that? do you use fastcgi or cgi? how do you execute your code? inside some chroot environment or some other kind of virtual maschine. mta`chrono
Re: Raw binary(to work without OS) in D
Am 22.06.2012 19:23, schrieb Walter Bright: On 6/22/2012 7:11 AM, Mehrdad wrote: One way is to get the library source code for the C compiler and study it. By get you mean buy, right? For Digital Mars C, yes you can buy it. For gcc, you can look at the C library source code for free. I'm sure the latter does the same things. I find that to be against D's (supposedly) open-source nature... D is open source, however, that isn't necessarily true of C. For example, the Win64 version of dmd will be designed to work with Microsoft VS, which will cost $500. I'm afright. Please explain what is meant by this, Walter.
Re: static array literal syntax request: auto x=[1,2,3]S;
Am 10.06.2012 01:02, schrieb Timon Gehr: On 06/10/2012 12:34 AM, Jonathan M Davis wrote: On Sunday, June 10, 2012 00:15:01 Timon Gehr wrote: D static array literals don't perform a costly heap allocation. It is simply a bug in the implementation. This is not a compelling reason to add new syntax. D DMD doesn't _have_ static array literals. It only has dynamic array literals. int[5] a = [1, 2, 3, 4, 5]; This is a static array literal. should definitely be optimized such that it doesn't do any heap allocations, but the array literal itself is dynamic regardless, as typeof indicates. I don't see a typeof there. The array literal is a static array literal if it is assigned/converted to a static array. The other place that this causes problems is templated functions. e.g. void func(A)(A array) if(isStaticArray!A) {} func([1, 2, 3, 4, 5]); will fail to compile. You're forced to create one on the stack first. int[5] array = [1, 2, 3, 4, 5]; func(array); func(cast(int[5])[1,2,3,4,5]); That _might_ merit adding a syntax for indicating that an array literal is static. Yes, certainly. I was simply pointing out that arguing about performance makes a poor case here. However, in general, it's definitely true that the additional heap allocations that we currently see should just be optimized out by the compiler, and if that's all that we're trying to solve, then that's a matter of fixing the optimizer, not the language. This is not about optimization. Allocating is simply incorrect. It is a 'wrong code' bug. Yes, you're right. And you've also shown that we don't need a new syntax to accomplish this.
Re: valid uses of shared
Would this be legal? class A { private static shared int counter; // shared across all instances this() { auto i = ++counter; pragma(msg, typeof(i)); // prints int } }
Re: Windows 2000 support
Drop support since even Microsoft dropped support. Even if druntime will support Windows 2000, all my the programs I code will at least require Windows XP.
Re: synchronized (this[.classinfo]) in druntime and phobos
Am 31.05.2012 17:05, schrieb Regan Heath: .. but, hang on, can a thread actually lock a and then b? If 'a' cannot participate in a synchronized statement (which it can't under this proposal) then no, there is no way to lock 'a' except by calling a member. So, provided 'a' does not have a member which locks 'b' - were deadlock safe! So.. problem solved; by preventing external/public lock/unlock on a synchronized class. (I think the proposal should enforce this restriction; synchronized classes cannot define __lock/__unlock). R I think it doesn't matter whether you expose your mointor / locking / unlocking to the public or not. You can always unhappily create deadlocks that are hard to debug between tons of spaghetti code. shared A a; shared B b; void thread1() { synchronized(a) // locks A { synchronized(b) // ... then B { // . code } } } void thread2() { synchronized(b) // locks B { synchronized(a) // ... then A { // . code } } }
Re: synchronized (this[.classinfo]) in druntime and phobos
Am 30.05.2012 11:11, schrieb deadalnix: D already have much better tools that the one java provide (std.concurency, std.parallelism, TLS by default, transitive type qualifiers, . . .) that most these thing taken from java don't make any sense now. For instance, what is the point of being able to lock on any object when most of them are thread local ?? Right! Locking on non-TLS objects doesn't make sense. Perhaps only shared objects should be synchronizeable and thus contain a monitor / pointer to a monitor.
Re: synchronized (this[.classinfo]) in druntime and phobos
Am 31.05.2012 08:47, schrieb Jacob Carlborg: What should have been done is something like this: 1. Designing feature X 2. Show the new feature for the community 3. Consider the feedback and possible tweak/redesign 4. Implementing in an experimental branch of the compiler 5. Release an experimental version with just this feature 6. Repeat step 3-5 until satisfied or put on hold/drop the idea 7. Prepare Phobos and druntime for the new feature 8. Move the implementation to the main branch 9. Ship feature X with the next release 10. wait 11. Fix bugs for feature X 12. Repeat step 10-11 a couple of times 13. Write about it in TDPL +1
Re: UnixSocket
Am 12.05.2012 19:32, schrieb Shadow_exe: He writes that is not supported, but why?? Maybe you shouldn't try using a TcpSocket for opening a UNIX socket. auto socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
Re: foreach_reverse error
group returns a lazy forward range. use foreach(i; group(retro(ints))) Yet another reason foreach_reverse needs to go. T No please don't! There are hundred and ten very usefull cases.
Re: Why typedef's shouldn't have been removed :(
Maybe it's not directly related to this topic, but shouldn't that be rather part of druntime? Only if something else in druntime needs it, which it doesn't. - Jonathan M Davis There is a real trend to purify the language. I also think it's the right decision to replace compiler intrinsics / language feature with their library counterparts. Moving stuff to phobos is fine as long as you use phobos. But I'm using tango and druntime. I haven't even installed phobos on my system. The same impacts deimos. People tend to create unneccessary phobos dependencys.
Re: Why typedef's shouldn't have been removed :(
Am 09.05.2012 11:53, schrieb Jonathan M Davis: On Wednesday, May 09, 2012 10:00:37 mta`chrono wrote: Maybe it's not directly related to this topic, but shouldn't that be rather part of druntime? Only if something else in druntime needs it, which it doesn't. - Jonathan M Davis There is a real trend to purify the language. I also think it's the right decision to replace compiler intrinsics / language feature with their library counterparts. Moving stuff to phobos is fine as long as you use phobos. But I'm using tango and druntime. I haven't even installed phobos on my system. The same impacts deimos. People tend to create unneccessary phobos dependencys. In general, we're not sticking anything in druntime unless it needs to be there. It's also pretty much expected that projects will use Phobos. druntime isn't even provided at a separate library when distributed with dmd. If you're specifically trying to avoid using Phobos, you can do that, but don't expect stuff that doesn't need to be in druntime to be put into druntime just because you don't want to use D's standard library. Since Phobos is statically linked at this point, the parts that you don't use wouldn't be pulled in anyway. But you can also copy it from Phobos and put it in your project if you want to (as long as it doesn't have a lot of other dependencies in Phobos). It's nothing more than a general design decision what belongs into druntime and what doesn't. I don't expect you to do anything just because I say so (Don't believe me!), but since this newsgroup is open for everybody to post his/her crap, I'll do similar. ;-) The question I had to came is across is What is druntime?. It provides D's _meat and potatoes_ used for _fundamental_ features of the language like garbage collecting, threads, synchronisation and it's even used for array manipulation. Coding D without druntime is not possible. Sooner or later dmd will be able to support ARM android or iOS. And then we'll be lucky to only port druntime to the new plattform. Phobos is a really powerfull library but it's too fat with all it's dependencies. (libcurl is one of it). The reason why C is so powerfull and runs even on a tiny 1,59 €uro AVR processor is quite simple. It's _NOT_ too much coupled to any standard library. There are hundreads glibc, uClibc, bionic, diet libc. just to mention a few. Personally, I don't know how you could get by without using Phobos for at least std.traits unless you avoid templates (which would _really_ be reducing D's power - I'd hate to use D without templates), since it's a _lot_ harder to have good template constraints without std.traits. That's how I do for now: Copying std.traits to tango.core.Traits. It works quite fine unless you start using tango and phobos side by side in a hybrid project. That's why I prefer a common core.traits. - Jonathan M Davis Okay, now you got my 50 Cents. Thanks for reading.
Re: Future of D style variadic fuctions
Am 09.05.2012 08:10, schrieb SiegeLord: For the ignorant: I do NOT mean variadic templates as used by std.stdio. I note that they are not mentioned in TDPL. What is the deal with them and their future? I'll be very displeased if I have to recode a good bit of Tango that uses them if they are removed... None of my attempts at coding a replacement for them using variadic templates have matched their efficiency (in terms of generated code size) or ease of use (they invariably require a shim function). -SL I remember that we already had a discussion of that long ago, but why not just replacing them with variadic templates like I did in my tango fork. Basically you only need to change tango.text.convert.Layout heavily. The rest are trivial changes on every stuff that is using tango's formater. But that doesn't have to necessarily say that you're breaking existing code!
Re: GSOC Linker project
Am 04.05.2012 01:47, schrieb Trass3r: I'm interested in starting a project to make a linker besides optlink for dmd on windows. Imho changing dmd to use COFF (incl. 64 support) instead of that crappy OMF would be more beneficial than yet another linker. My vision is to create a linker in a relatively modern language (D) and to release the project as open source. If you do write a linker then make it cross-platform right from the start; and modular so it can support all object file formats. Yes supporting COFF would be a great benefit on Windows and would allow the user to use other compilers and linkers in conjunction with D. The other point: Writing a linker as part of GOSC 2013 will be an ease for you if you've implemented COFF since you don't need any furthur ramp-up time ;-).
Re: Why typedef's shouldn't have been removed :(
Am 08.05.2012 16:03, schrieb bearophile: Steven Schveighoffer: But making std.typecons.TypeDef work *is* a valid path to get what you want (typedefs that work like they used to). If that isn't possible, let's fix the language constructs that are blocking it! Right. Bye, bearophile Maybe it's not directly related to this topic, but shouldn't that be rather part of druntime?
Re: Why typedef's shouldn't have been removed :(
Am 06.05.2012 14:22, schrieb John Campbell: On Saturday, 5 May 2012 at 05:02:48 UTC, Mehrdad wrote: Now it's impossible to figure out whether a ParameterTypeTuple contains an HWND versus an HGDIOBJ or whatever... this should really be fixed... Since I don't see it discussed in this thread: Which problems do you have with http://dlang.org/phobos/std_typecons.html#Typedef? John There are a lot of people using D as a better C. Templatisation of every language keyword in conjunction with forcing the user to have phobos dependency is a real _PAIN_.
Re: ptrace (process trace system call) on Linux from D
(2) Is it more D-ish to use something like enum PTRequest { traceMe = 0, ... } instead of the fully capitalised originals? It doesn't seem to affect the working of things. Yes, that's more D-ish. In new D code I prefer the camelcased ones, but there are cases where you'd like to use the original ones. it's up to! ;-) (3) wait() is declared as returning a pid_t in the manpage, and is declared as such in core.sys.posix.sys.wait. In std.c.process however, it returns an int. I can't even find a process.h in my Linux install. What am I supposed to use? I know it essentially doesn't matter, as pid_t is aliased as int. Are there D alternatives to wait() and fork() that I could use with ptrace() instead of the C posix system functions? (4) Some things are declared only in core.*, not in std.*. Will they be added at some point or is this how it's supposed to be? I thing core.* (druntime) is the right place for _all_ bindings to libc. But yeha, there are still some relicts in std.c.* of the good old days. What do you meant by D alternatives to wait() and fork() that could be used with ptrace(). Maybe I don't understand your intention.
Re: Can we kill the D calling convention already?
Am 24.04.2012 10:42, schrieb Alex Rønne Petersen: Writing portable code is hard enough as it is. Why do we have to have some random, D-specialized calling convention (only on Win32 and only in DMD)? The result of the current state of things is that extern(D) is essentially useless - it has completely different meanings across compilers. You cannot rely on it at all. If memory serves me right, both LDC and GDC just alias it to extern(C), but DMD insists on using this magical D calling convention on Win32. I'm not attacking the D ABI (name mangling) here, but I do think this calling convention needs to either go away, or be optional (i.e. as some extern() argument). We *have* to make extern(D) consistent across compilers, or we'll be no better than the mess that is C and C++; we're advertising a standard inline assembler with support for naked functions, but that support is useless if we don't have a consistent default calling convention. Introducing a commen calling convention would be one approach. The other would be to templatize D's inline assembler?
Re: ptrace (process trace system call) on Linux from D
Am 25.04.2012 18:36, schrieb Matej Nanut: Hello everyone, I would like to know how to call ptrace (the system call) from D. I don't know what to import or link. If my understanding is correct, I need to create a .di file of some sort with stuff declared in it. How would I do this? Thanks, Matej Hello Matej, I guess you're asking for http://linux.die.net/man/2/ptrace. normally it's somewhere deep in druntime but I couldn't find it. Maybe someone is able to add it for you. But neverthenless, you can just put some declaration in your D file and call it. import core.stdc.stdio; import core.sys.posix.sys.types; enum __ptrace_request { PTRACE_TRACEME = 0, PTRACE_PEEKTEXT = 1, PTRACE_PEEKDATA = 2, PTRACE_PEEKUSER = 3, PTRACE_POKETEXT = 4, PTRACE_POKEDATA = 5, PTRACE_POKEUSER = 6, PTRACE_CONT = 7, PTRACE_KILL = 8, PTRACE_SINGLESTEP = 9, PTRACE_GETREGS = 12, PTRACE_SETREGS = 13, PTRACE_GETFPREGS = 14, PTRACE_SETFPREGS = 15, PTRACE_ATTACH = 16, PTRACE_DETACH = 17, PTRACE_GETFPXREGS = 18, PTRACE_SETFPXREGS = 19, PTRACE_SYSCALL = 24, PTRACE_SETOPTIONS = 0x4200, PTRACE_GETEVENTMSG = 0x4201, PTRACE_GETSIGINFO = 0x4202, PTRACE_SETSIGINFO = 0x4203 } extern(C) long ptrace(__ptrace_request request, pid_t pid, void *addr, void *data); void main() { // just call ptrace like you would do in C }
Re: Can we kill the D calling convention already?
As D is more than just C or C++ it may take account for providing it's own calling convention. _BUT_ (That's the point, I agree to Alex), it needs to be consistent across _different compilers for the same plattform_. Maybe someone can point out the benefits of having a different calling convention on linux and windows for the same target machine.
Re: How can D become adopted at my company?
Am 24.04.2012 21:53, schrieb Brad Roberts: Neither Walter (in this case) nor the question asked for re-writting anything. In fact, that's frequently stated (again, by Walter and others, including myself) as explicitly a non-goal. Rewriting applications to another language is an exercise in time wasting and bug-reintroduction. Unless you have _another_ driving reason to do a rewrite, don't. So, the obvious follow up.. what have I done with D where I work? Little, other than get it on the approved list of software we can use. It's not on the list of officially supported languages (more a defacto thing than an actual list). But the key problem is that I haven't written any new code in a very long time, something I miss more and more. The applications I do touch are all pre-existing code bases, so see above about rewriting. My 2 cents, Brad Exactly!!! That's the point. I fully agree with this and we should take account to this in every furthur endeavours. D must be seamlessly integratable with any kind of existing codebase.
Re: Shared library in D on Linux
I'm interessting in the same stuff. I've a question to _tlsend and _tlsstart. What are they used for? My disputable presumption was that they point to the begin of TLS segment. What is _deh_begin and _deh_end used for?
Re: Creating a shared library in D : undefined symbol: _deh_beg
The compiler is able to generater position independant code but as far as I remember, there are still some issues in druntime which make it difficult to create dynamic librarys in D. You need to somehow initialize the runtime.
Re: Linux and D wallpaper :)
Cool! Nice work!
Re: Use tango.core.Atomic.atomicLoad and atomicStore from Tango
Am 26.03.2012 19:26, schrieb Lukasz Durniat: Problem has been solved by me. Can you please tell me how you'd solved it?
Re: Does D supply basic error codes?
import core.stdc.stdlib; int main() { return EXIT_FAILURE; // EXIT_SUCCESS works here too. } Am 30.01.2012 00:21, schrieb NewName: Hello all. C has EXIT_FAILURE and EXIT_SUCCESS to be returned from main(). Does D have similar predefined values?
Re: char* to long
Why not just go the good old way? you char* should be zero terminated when coming from c. private import core.stdc.stdlib, std.stdio; void main() { const(char)* str = 1234567890.ptr; long lng = atoll(str); writeln(lng); }
Re: GCC depen issue on linux
It seems like you have installed a precompiled version of dmd. Can you post eactly the source where you've downloaded it? dmd seems to require version _2.11_ of glibc. there are a lot of versions installed on your system. 2.0,2.1,2.3,... But not the one dmd requires. In order to solve the problem, I would suggest you to download dmd sources and compile them.
Re: Incompatible libphobos2.a?
I just built both 32 64 bit DMD. The 32 bit works fine, but the 64 bit not. I always get this: /usr/bin/ld: skipping incompatible /home/anta40/Digital-Mars/dmd-dev/lib64/libphobos2.a when searching for -lphobos2 Did you compile druntime for 64 bit, too? As libphobos2.a is just an archive file, you're able to extract it and check if all containing objs are 64 bit. have a look at the linux file command.
Re: Incompatible libphobos2.a?
Am 03.01.2012 12:10, schrieb Trass3r: There's another recent thread about this. The makefile is a mess. it doesn't build separate libs. Here's a Linux patch for druntime: Is this going to be official? I'd like to see that in druntime.
Re: string is rarely useful as a function argument
there are lot of people suggesting to change how string behaves. but remember, d is awesome compared to other languages for not wrapping string in a class or struct. you can use string/char[] without loosing your _nativeness_. programmers targeting embedded systems are really happy because of this. by the way, I don't want to blame someone, but I think we diverged from the original purpose of this topic. __string is rarely useful as a function argument__ I think he points out that choosing _string_ type in function arguments is _wrong_ in most cases. and there isn't much use of inout in phobos as it was broken for a long time.
Re: cl4d OpenCL wrapper moved to Github
hey that's cool. thank you for your effort. what about moving this to deimos? - mta`chrono
Re: D2 port of Tango
Another thing, I got many problems generating documentation. $ make doc -f posix.mak ... tango/core/RuntimeTraits.d(569): use of typedef is deprecated; use alias instead tango/core/RuntimeTraits.d(569): use of typedef is deprecated; use alias instead ... Me too! I've fixed that. Solution was just to replace typedef with alias on Line 569. Just do `git pull`.
Re: string is rarely useful as a function argument
I understand your intention. It was one of the main irritations when I moved to D. Here is a function that unnecessarily uses string. /** * replaces foo by bar within text. */ string replace(string text, string foo, string bar) { // ... } The function is crap because it can't be called with mutable char[]. Okay, that's true. Therefore you'd suggested to alias const(char)[] instead of immutable(char)[] ??? But I think inout() is your man in this case. If I remeber correctly, it has been fixed recently. I'm not quite sure if I got your point. So forgive me if I was wrong.
Re: D2 port of Tango
Ok, so if this tango will be quite different than the original one, is not a good idea to change its name? Just to make it more clear and less confusing. Tango2 is enough, I think. Yes, but phobos is called phobos instead of phobos2. I'll think about it ;-).
Re: D2 port of Tango
Al 24/12/11 14:20, En/na mta`chrono ha escrit: Unlike SiegeLord's branch I've removed tango's runtime and build on top of druntime. This step is inevitable in order to make tango and phobos work side by side. SiegeLord's branch do not need druntime lib to be present on the system when compiling tango-d2, and the resulting libraries can be used together with phobos. If you start use phobos and tango more intensively, you'll ran into different problems. Consider this: Cannot implicit convert struct timeval to struct timeval. Just because there are two definitions, one in druntime and another in tango. Sooner or later you'll get crazy. I'm going to remove everything that's already present in druntime. import std.stdio; import tango.io.Stdout; void main() { writeln(hello phobos!); Stdout(hello tango!).newline; } Properly compiles and run. So, is it not a good idea to join forces to advance more strongly, since pursued the same goal? Best regards, Okay, I've also changed a little bit of tango's original api. People might dislike this. But it's a little bit more KISS (Keep it small and simple). tango.utils.container.more.Stack. Why not just use tango.container.Stack ?
Re: D2 port of Tango
Hey Jordi, thank you for posting your results!!! :-) It tries to read core.sys.posix.sys.un which is part of druntime. Unlike SiegeLord's branch I've removed tango's runtime and build on top of druntime. This step is inevitable in order to make tango and phobos work side by side. The file that cannot be read on your system is definitivly there. https://github.com/D-Programming-Language/druntime/blob/master/src/core/sys/posix/sys/un.d You just need to checkout druntime, phobos and tango and put them in some kind of following file structure. /usr/include/d/dmd/druntime /usr/include/d/dmd/tango /usr/include/d/dmd/phobos Then compile druntime, phobos and tango. - mta`chrono
Re: D2 port of Tango
Hey, that's cool. How did you create it? I'd like to create a .deb for my tango branch, too. https://github.com/mtachrono/tango - mta`chrono
Re: D2 port of Tango
I'm using dmd 2.058 and `make -f posix.mak` to compile it. Can you please tell me your errors? - mta`chrono
Re: newbie question: Can D do this?
In PHP frameworks often use $option arrays which are some kind of key value pairs. they are merged with the default valuzes inside the function. pro: - you can pass an argument by name - you only need to pass those who needed. cons: - hash arrays it should be possible to create a similar method in d. but I really don't like this solution in d. it feels bad and looks ugly. ?php $model-query(array( 'firstname' = 'John', 'country' = 'France', 'order' = 'asc' )); class Model { function query($options = array()) { // merge with defaults $options = array_merge(array( 'deep' = true, 'order' = 'desc', 'type' = 'sql', 'backend' = 'mysql' ... ), $options); } } ?
Re: Bridging C++ and C#
I like their approach. They're using gcc-xml to parse c++ files and generate approtiated wrapper code. maybe we could write a similar tool for d.
Re: D bindings for openssl added to Deimos
Hey that's cool. Thanks David! By the way. Why does this https://github.com/D-Programming-Language/deimos still exists?
Re: dmd.conf's -L--export-dynamic prevents my compiler from working
Your problem seems to be really frustrating. I'm using ubuntu amd64 and everything is fine here. I'd like to reproduce your issue. Can you paste a link to your gentoo installation iso file. I'll setup a VM here. Did you install dmd,druntime,phobos from sources or some kind of packages/repo?
Re: Any plans to make it possible to call C++ functions that reside in a namespace?
Adding namespaces to C++ interfacing would be great. AFAIK you could also create a linker file and rename the symbols before linking. -- suggestion: extern(C++, MyNamespace) interface Foobar { void foo(); void bar(); }
Re: Restrict access to critical functions
Maybe you should use a VM to run your restricted applications. Or have a look a chroot, dchroot or schroot, to setup such stuff. The Programming Language will not help you in this case!
Re: How to stop DMD from linking against phobos
Is there a way to stop dmd from linking against phobos? (Most preferred would be some command line parameters to dmd) We should fix defaultlib and debuglib to accept empty values. Can you make a bug report for it. # dmd code.d -v -defaultlib= gcc code.o -o code -m64 -Xlinker -L/usr/lib32 -Xlinker -L/usr/lib64 -Xlinker --export-dynamic -lrt -l -lpthread -lm -lrt This line works for me. I can't tell you why dmd invokes gcc instead of ld. But you could also use -c switch and call the linker manually.
Re: Second Round CURL Wrapper Review
2. etc.curl, std.curl, or std.net.curl? (We had a vote a while back but it was buried deep in a thread and a lot of people may have missed it: http://www.easypolls.net/poll.html?p=4ebd3219011eb0e4518d35ab ) What about: Low Level Part -- deimos High Level Part -- std.curl
Re: dup method const or not?
Okay, what about this hack? --- import std.bitmanip; import core.stdc.string; void main() { const(BitArray) foo; BitArray bar; bar.len = foo.len; bar.ptr = foo.ptr[0 .. foo.dim].dup.ptr; } ---
Re: dup method const or not?
that's a real good question. it fails with the following error: Error: function std.bitmanip.BitArray.dup () is not callable using argument types () const here is a hack: --- import std.bitmanip; import core.stdc.string; void main() { const(BitArray) foo; BitArray bar; memcpy(bar, foo, BitArray.sizeof); } ---
Re: auto
Did you know that auto is not auto in the way auto behalfs. it's just a placeholder so the compiler can determine that a variable follows. but you can use any other keyword for type interfering, too. void main() { const a = FunctionThatReturnsSomething(); static b = 5.0; scope c = hey; }
Re: is D ncurses-only language?
It should be possible to simply create smart pointers that wrap C++ classes in D though. Martin, what needs to be done to use SmartPtrs for every c++ class without using a c-wrapper?
Re: is D ncurses-only language?
It actually needs a tiny patch on windows (nonvirtual_fun is mangled as static function). Unfortunately I did not find a way to sensibly declare member a in D. There is another bug that a derived class is using a wrong virtual function table offset, but that should be fixable. It's very important that dmd will be able to call C++'s non virtual functions and it's ctors/dtors. But there must be some significant reasons why Walter didn't accept the patch.
Re: DFastCGI
IIRC there are two version of fastcgi / fgci ? The one is using stdin, stdout for communication and the application is running as a child of the webserver. And the other is running as a standalone application using unix sockets for communcation. Is DFastCGI able to handle both?
Re: Deimos: Consistent structure?
Making import deimos.ncurses import everything is just wrong. NCurses consists of 13 libraries. 4 of them are the most important to the user (developer): curses, menu, panel and form. Importing panel if you never use NCurses panels is pointless I think. It is not a big library though... ... I think in this case import deimos.ncurses; should _NOT_ be available. It's pointless, I agree in what you said. It needs to be devided into serveral modules. import deimos.ncurses.curses; import deimos.ncurses.menu; import deimos.ncurses.panel; import deimos.ncurses.form; -- 1. smart library bindings Those bindings that fit in a _single_ module. They consists of a single source file and can be imported via import deimos.libname; 2. bigger library bindings They _don't_ fit in a single module and therefore they provide different modules. they can be imported via import deimos.libname.sub1; import deimos.libname.sub2; ... 3. aggregation of bindings In _some_ cases it seems to be useful if you can import _all_ modules at once. deimos.libname.sub{i} is renamed to deimos.libname_.sub{i} and a dummy deimos.libname is added to import them all at once. I'm very interessted in your personal opinion. So: Free for comments :-)
Re: Discussion on D support in gdb
A noob question from my side: What is DWARF? By the way I never touched the sources of gdb. I'm just a friendly user of it.
Re: In my whole life
Actually I don't know how you are and additionally I don't understand 100% of what you saied, because I don't know the whole context. And I need to say that normally I don't answer people who start flaming, blaming and insulting others. It leads to nowhere if people start talking unobjective. But this time your posts seems be a little different from all the one's in past. Please let me know if I'm wrong.
Re: Deimos: Consistent structure?
It would be great if a single include statement in /etc/dmd.conf would be enough to use all deimos projects: -I/usr/include/d/dmd/deimos or -I$HOME/include/d/deimos Then just pickup your preferated deimos projects from the website and put them into your local deimos folder. I suggest to consistently use deimos.libname_.modulname; import deimos.ncurses_.termcap; import deimos.ncurses_.cursslk; import deimos.ncurses_.eti; import deimos.lzma_.delta; import deimos.lzma_.index; import deimos.zmq_.zmq; import deimos.zmq_.utils; import deimos.mysql_.keycache; import deimos.mysql_.debug; import deimos.mysql_.embed; ... If you are going to import _all_ modules of a deimos lib then use this shortcut: import deimos.ncurses; import deimos.lzma; import deimos.zmq; import deimos.mysql; ... Free for comments! - mta`chrono
Re: Deimos: Consistent structure?
No, I don't think it's any overhead. But I want this to be handled by a package manager. I want a file that says: this project depends on these libraries. Then it's up to the package manager to install and make them available for the compiler. I think your intention to make use of a package manager is implicit shared by Dejan. It would be cool to provide a packet manager for windows and to have a deimos_to_deb converter. Think of apt-get install dpl-deimos-lzma :-)...
Re: The book Programming in D is in beta
Great work! I also strongly suggest doing a Kindle version as well, even if you keep a free html version on the web. Having more D books on Amazon will help raise the profile of D. Great work! Yes, offer a kindle version for 79 EUR and upload a free pdf version in the name of a famous release group on usenet, torrent and several warez site. I promise you, that you'll spread the world.
Re: [deimos] [tutorial] [rfc] How to set up a git repository to simplify keeping bindings up to date
According to the deimos manifesto: - Deimos is a collection of C header files to publicly available C libraries and their translations to D. The idea is that if, in C, to interface to a library one would write: #include foo.h then the corresponding D code would look like: import foo; or: import deimos.foo; Sorry, that I've to say that, but I think this is crap. A very different approach that we know from C, the D language offers a great feature called namespaces. In fact we're able to arrange our modules in the namespace that doesn't have necessarily to match with the corresponding filename. There has always been the bump that some people wrote #include mysql.h and compiled with -I/usr/include instead of -I/usr/include/mysql. Most of the .h files that are stored directly (without subfolders) in /usr/include are already covered by druntime. So, why not just use __ONE__ convention for all the rest? import deimos.library.modulename; === Examples: === private import deimos.lzma.base, deimos.lzma.block, deimos.lzma.container, deimos.lzma.version; private import deimos.gtk.gtk, deimos.gtk.window, deimos.gtk.celllayout, deimos.gtk.assistant, deimos.gtk.misc; private import deimos.x11.xlib, deimos.x11.xutil, deimos.x11.xos, deimox.x11.keysym, deimos.x11.xatom; private import deimos.libpng.png, deimos.libpng.conf; private import deimos.cairo.pdf, deimos.cairo.svg, deimos.cairo.ps; private import deimos.mysql.global, deimos.mysql.embed, deimos.mysql.version; Additionally we could provide some shortcuts. If you do import deimos.library; it will public import deimos.library.*; === Examples: === import deimos.lzma; import deimos.gtk; import deimos.x11; import deimos.libpng; import deimos.cairo; import deimos.mysql; And last but not least I prefer using https://github.com/D-Programming-Deimos instead of https://github.com/D-Programming-Language/deimos. Imagine if deimos becomes bigger and we'll have more than 100 pending pull requests across different bindings. That will all result in a big mess. So please each binding should have it's own repository. If you're going to install all, then add d-p-l to your /etc/apt/sources.lst and enter apt-get install deimos-*. Or make use of a shell script that iterates through all repos in /usr/include/d/dmd/deimos and calls git pull.
Re: [deimos] [tutorial] [rfc] How to set up a git repository to simplify keeping bindings up to date
Hey Johannes, thanks for your great effort of writing a tutuorial. Later on you'll have to import the bindings this way: import systemd.deimos.sd_daeamon; import systemd.deimos.sd_readahead; I rather prefer something like this: import deimos.systemd.sd_daeamon; import deimos.systemd.sd_readahead; import deimos.mysql.mysql; import deimos.cairo.pdf; import deimos.cairo.svg; import deimos.gtk.gtk; - mta`chrono
Re: Class inheritance bug
Hi Tobias, in your last post you'd asked something about sockets and now you're asking about threads which leads me to say: You don't need threads to use thousands of sockets at the same time. There is Socket.select which is some kind of multiplexer doing all the nasty shit for observating multiple sockets. If you really wanna use threads, then please note: you don't need to subclass it. you can of course but it also accepts a delegate or a function in it's constructor. import core.thread; void foobar() { } void main(); { Thread thread = new core.thread(foobar); thread.start(); }
Re: Class inheritance bug
Dont understand me wrong. You can subclass it OR you can use it like it is. Two possibilies to use. Use the one that suits your needs. By the way, there is a newsgroup called D.learn which I think is a better place for your questions. - mta`chrono Example 1 import std.stdio; import core.thread; class MyOwnThread : Thread { public this() { super(run); } private void run() { writeln(I'm a new Thread); } } void main() { MyOwnThread thread = new MyOwnThread(); thread.start(); } Example 2 import std.stdio; import core.thread; void foobar() { writeln(I'm a new Thread); } void main(); { Thread thread = new core.thread(foobar); thread.start(); }
Re: Linking Error (WS2_32.LIB)
Did you try to compile tango and druntime on your own or was that a precompiled package that you've downloaded? Normally make clean and rebuild helps in that case. You could dig the sources of phobos and look if std.socket containts the symbols and then compare them with the symbols of phobos.lib. But unfortunally this is a more advanced task. can you tell me what you've actually downloaded? I've a windows xp virtual maschine here and I'd like to replicate your issue.
Re: Linking Error (WS2_32.LIB)
Hello Tobias, thanks for attaching your code. I think we're getting closer to the bug. What is class LanAddress : Address { } used for? I don't understand it's purpose. I've modified your code for the usage of TCP/IP. Note: SocketType.RAW is for geeks only ;-). Compile: dmd -m32 main.d ws2_32.lib Usage: main.exe digitalmars.com - mta`chrono import std.socket; import std.stdio; import std.string; import std.conv; int main(string[] args) { // declaration string host; ushort port = 80; // set correct host if(args.length 1) { host = args[1]; } else { write(Connect to: ); host = readln().chop(); } // create addr and socket InternetAddress address = new InternetAddress(host, 80); Socket socket = new Socket(AddressFamily.INET, SocketType.STREAM); // print target writeln(connecting ', address.toString(), '); // connect to address socket.connect(address); // sending socket.send(GET /\r\n\r\n); // receiving char buffer[1024]; uint size = socket.receive(buffer); writeln(ansered: ', buffer[0..size], '); // all done, no error return 0; }
Re: Linking Error (WS2_32.LIB)
Am 10.11.2011 20:46, schrieb Walter Bright: On 11/9/2011 10:09 AM, Tobse wrote: OPTLINK (R) for Win32 Release 8.00.12 Copyright (C) Digital Mars 1989-2010 All rights reserved. http://www.digitalmars.com/ctg/optlink.html dist\client.obj(client) Error 42: Symbol Undefined _D3std6socket7Address8toStringMFZAya dist\client.obj(client) Error 42: Symbol Undefined _D3std6socket7Address13addressFamilyMFZE3std6socket1 3AddressFamily dist\client.obj(client) Error 42: Symbol Undefined _D3std6socket7Address7nameLenMFZi dist\client.obj(client) Error 42: Symbol Undefined _D3std6socket7Address4nameMFZPS3std1c7windows7winsoc k8sockaddr --- errorlevel 4 To compile main.d and link with ws2_32.lib, dmd main.d ws2_32.lib will work. However, that is not the problem you're having. There's clearly a mismatch between the phobos.lib you're linking with and the std.socket being read by the compiler. One is out of date with the other. In other words, the undefined symbols reported by the linker appear in std.socket but do not appear in phobos.lib. Walter, have you looked into his source. What he did was: - BEGIN -- import std.socket; class FoobarAddress : Address { } void main() { } -- END - compile this with dmd -m32 main.d and you'll see exactly the same errors that he posted. Even tough dmd's error message are a little bit confusing in this case, the problem should be clear. - mta`chrono
Re: Linking Error (WS2_32.LIB)
After compiling the sources dmd will call optlink to do the linking. I don't know why it's failing, but try to pass -v to dmd to see what's happening. Once you're done, you'll see how it calls optlink which is documented here: http://www.digitalmars.com/ctg/optlink.html Command line operation of OPTLINK uses the following syntax: LINK obj[,out[,map[,lib[,def[,res] Please also have a look at the environment variables (See link). Optlink will use them as search pathes. But it's also explanied there. I'm not quite sure, because I'm living in the linux world. But maybe you could also use the mingw tools to link ??? - mta`chrono
Re: DSQLite a libraryri using sqlite
.I am afraid that Phobos will take another 3 years to consolidate. std.database is just another indication for that.. my 2 Euro cents ( pretty weak nowadays :) Bjoern. Yes, you're right there is no coordination in development. Some are talking about CAPI Manifesto and some others are talking about deimos. There is https://github.com/D-Programming-Language/deimos And there is: https://github.com/D-Programming-Deimos/ There are pending pull requests, so what are we waiting for?
Re: [D-Programming-Deimos] Review process?
Does anyone know the last state of Deimos? What are we going to use now. This: https://github.com/D-Programming-Language/deimos Or that: https://github.com/D-Programming-Deimos/
Re: DSQLite a libraryri using sqlite
Hi bioinfornatics, I recognized you'd used Variant as datatype. Did you define your own Variant Type or is that the default one? But neverthenless your code simplyfiecs using sqlite. - mta`chrono
Re: D2 port of Tango
No he said he was surprised Tango reallocated without him knowing about it. If this is actually documented behavior, then that could be ok. I think this behavoir should be changed in tango d2. if you pass a buffer then it should be used or not (if it's not big enough for any reason). but no hidden memory allocation.
Re: D2 port of Tango
You will never satisfy both worlds (simplicity vs flexibility). Both Phobos and Tango have their place in the D community. It is unfortunate many people in the D community fails to see it. Also, it is unfortunate (but very easy to explain) that Tango project started as a complete implementation of the run-time library. We debate this for years on irc:// irc.freenode.org/d and it never ends. Tango d2 should give up it's own runtime and consequently use druntime, even though this is an immense change that nearly affects everything to change. Nobody will be able to maintain two runtime's at the same time. You'll have to be aware of so many stuff. Even if you provide a method that the user can choose between tango's runtime and druntime, you will have to mess around with duplicate declarations etc. In one module you're using tango's struct sockaddr declaration and in the other you'll try to pass it to a functions that requires druntime's struct sockaddr. the compiler will complain that you cannot pass sockaddr where sockaddr is required. So please give up tango's runtime and make a consequent use of druntime. If someone want's to customize the behavoir of the gc for example than he should use druntime's possibilities to change it.
Re: Native D MySQL Driver
1) No UNIX Socket support in std.socket. Someone has added unix domain sockets in one of the phobos forks. I even think there's a pending pull request.
Re: D2 port of Tango
Yesterday I managed to compile all ported modules on Windows. So it looks like Tango for D2 should work on Linux and Windows right now. SiegeLord has created a master branch. I've deleted tango.stdc and parts of tango.sys in my fork. At first, a thousands of errors arose but I could fix them by using druntime instead. We need to do similar for windows. Lots of people are missing the point of whole project. Tango for D2 uses Druntime so it is quite normal to use Phobos and Tango together :) Yes, Tango for D2 should make use of druntime and deimos. I understand people are afraid that developing tango will split the community like it already happend in the past. But since tango and phobos use the same core, furthur tango developers will even contribute to druntime and deimos. Giving users a choice is great thing in my opinion. Not everyone likes the Phobos philosophy or its design decisions. Yes, though there is some lack of tangos design. It's too complex. IConduit, Conduit, Device, InputStream, OutputStream, InputFilter, OutputFilter... I don't understand why they haven't merged Conduit and Device?!? Somebody said that Tango hasn't got Andrei on board... Well, with all respect to Andrei as he is great developer but he is not the only one who knows how the things should be done. The whole tango.net module is example of great Design :) Lets say that Phobos has Andrei on board, and Tango has got Kris on board ;) Andrei on board means Andrei!T on board ;-). So, resuming, you can use Tango(D2) with Phobos, you do not have to sacrifice neither library. Lots of people sticks with D1 because of Tango... This maybe great step for those folks to go with flow, and D2 ;)
Re: build system
Am 27.10.2011 01:43, schrieb Gor Gyolchanyan: Totally. :-) On Thu, Oct 27, 2011 at 3:27 AM, bearophile bearophileh...@lycos.com wrote: Jacob Carlborg: * The compiler should only do one thing: compile code Currently DMD fails at this, because it also performs profiling, coverage analysis, unittest runner system, documentation files creator, JSON module description files creator, it prints dependencies on request, it calls the linker, and probably it does something more I am forgetting :-) Bye, bearophile how do you archieve to compile on 4 cores at the same time? dmd invokes it self? worker threads in dmd so that it can compile multiple files at the same time? I think the build system shouldn't be included in the compiler.
Re: D2 port of Tango
the reason I love tango is it's design. tango's approach is very c++ like and since I'm a Qt-Fan, I would flavour a d2 version like this: tango.io.Device + +++--+ vv| | tango.net.Socket tango.io.File | | ++| | ||| v +---++ | tango.io.ThreadPipe v |v || tango.net.TcpSocket | tango.net.UdpSocket| + | || | v |v | tango.net.LocalSocket | tango.io.BitBucket v | tango.net.SslSocket v tango.io.Console tango should use druntime and work with phobos side by side. this one works fine. import std.stdio; import tango.io.Stdout; void main() { writeln(hello phobos!); Stdout(hello tango!).newline; }
Re: build system
With simple makefiles you can compile .c, .cpp and .d, link them alltogether to a single executable, pass -j 4 to boost it up, strip the result, have different targets for doc generation, yeha :-) But please replace the odd make.exe on windows with gnu's version of make!!!
Re: What is shared functions?
void main() { shared s1 = cast(shared)new S(); s1.onlyShared(); // ok //s1.notShared(); // error: not callable using argument types () shared auto s2 = new S(); //s2.onlyShared(); // error: not callable using argument types () s2.notShared(); // ok } I would rather prefer auto s1 = new shared(S); because shared s1 = new S(); seems to allocate a TLS variable which is then casted to shared which is actually non-TLS.
Re: Just starting out
Feel free to help us porting tango to D2. We've already done a lot and some parts are quite usable. But don't expect to much. https://github.com/SiegeLord/Tango-D2
Re: The CAPI Manifesto
+1 Let's do it!
Re: foreach(r; requests) { r.concider(); }
I understand that you've suggested a different approach. But you can already implement some kind of custom iterations. Just create a function that returns this. class CustomDataClass { public typeof(this) filter(Color col) { // ... return this; } void opApply() ... } auto datas = CustomDataClass(); foreach(u, i; datas.filter(Color.Red)) { // ... } Am 12.10.2011 09:55, schrieb Gor Gyolchanyan: The foreach loop is truly a marvelous tool, which allows one to implement custom iterations, which look and feel just like all other kinds of iterations. The only philosophical problem with it is, that it thinks that only classes and structs can be looped over in a custom way and that they can have only one way to be iterated over. It would be great to be able to implement iterative algorithms for arbitrary types (templated iterations), like strided iteration to extract the red part of an image. It would also be great to be able to have more, then one kind of iteration for every type of iterable. Here's the list of what I mean by that: 1. Allow passing parameters to iterables in foreach: foreach(c, i; MyType(), 3) { } the `3` would be passed to MyType's opApply right after the delegate (of such an overload of opApply is available, of course). 2. Allow named foreach loops: foreach strided(c, i, MyType, 3) { } the `strided` is passed as a template parameter to the opApplly, which (depending on what overloads of opApply are available) may be optional. 3. Allow free-function opApply, which could be templated to work with any kind of iterable in a specific way: int opApply(string name : strided, Iterable)(Iterable iterable, int delegate(ForeachParamsTuple!Iterable) dg, size_t stride) { /* ... */ } this function would allow you to add stride to any iterable. the `ForeachParamsTuple` will return the tuple of parameters of the given iterable type. 4. Allow foreach loops with a single iterator to be specified without a body, in which case it would return an input range (or some other type of range), lazily evaluating and returning the iterator. void printRange(Range)(Range range) { foreach(r, range) { writeln(r); } }; unittest { printRange(foreach(i; 0..100)); } This would vastly improve the usability and performance of iterable types and ranges, since you no longer need to cache and copy around the data and you don't need to wrap it around delegating structs or classes either. The overloaded opApplies could be allowed to construct and return those ranges themselves. Yes, i know, you might have some questions like butthis wouldn't work withthat. I thought it out pretty carefully and the details are numerous, so I'd rather just answer those questions as they occur, instead of listing them all here. Given these four improvements iterations would become very easy and powerful. The iterations would become very flexible and easily used with range-based algorithms.
Re: My ignorance, or a bug - help please
-- mysql.d extern (C): struct MYSQL{} MYSQL* mysql_init(MYSQL* mysql); -- main.d - import mysql; struct Connection { MYSQL _mysql; ~this() { } this(int dummy = 0) { mysql_init(_mysql); } } void main() { Connection con1; Connection *con2 = new Connection(123); } - dmd main.d mysql.d -L-lmysqlclient works with DMD64 D Compiler v2.056
Re: My ignorance, or a bug - help please
If you don't need the internal data of struct MYSQL and you don't want to care about. Then just keep some reference in your program. alias void MYSQL; alias void MYSQL_RES; and then only use MYSQL* and pass it to every function. struct Connection { MYSQL* _mysql; ~this() { } this(int dummy = 0) { mysql_init(_mysql); } }
Re: T[n] a; immutable(T)[n] b = a; // error
int[2] a; immutable(int)[2] b = a.idup; Am 01.10.2011 13:00, schrieb Peter Alexander: int[2] a; immutable(int)[2] b = a; I get Error: cannot implicitly convert expression (a) of type int[2u] to immutable(int)[] Is there are reason for disallowing this, or is it a bug?
Re: Socket.send
Am 26.09.2011 18:09, schrieb Andrea Fontana: I'm working on a simple server written in d. I use a SocketSet to check requests from clients. I have to send back response and close connection. Is there a method to check if socket sent data or not with an async socket (so i can close it)? Simply use SocketSet and do some kind of select. You'll read 0 bytes from it, if it has disconnected.
Re: How can I use D to develop web application?
Thank you very much. I think the cgi module is lower effecient. I found fcgi(http://www.dsource.org/projects/fastcgi4d) and mango(http://www.dsource.org/projects/mango) which support servlet. But they don't support D2, anyone else can merge them to D2? zsxxsz I've some D2 code working with fastcgi. It accepts some web request, makes live a screenshot of my environment, converts it to png, and sends it back. basically it's an own implementation of the fastcgi protocol. but I think I haven't yet covered all of it. But it's sufficant for me /* * main */ int main(char[][] args) { // init FcgiApplication fastcgi = new FcgiApplication(); // listen fastcgi.listen(8080); // redirection fastcgi.accept(/redirect.html, (FcgiRequest request) { request.redirect(http://www.google.de;); }); // dir fastcgi.accept(/users.html, (FcgiRequest request) { request.send(a href=\/\back/a); request.send(directory!); string dir = std.process.shell(ls /etc); request.send(pre ~ dir ~ /pre); }); // counter int counter = 0; fastcgi.accept(/lukas.html, (FcgiRequest request) { counter++; request.send(hello world! ~ to!string(counter)); }); // show all variables fastcgi.accept((FcgiRequest request) { request.send(table); foreach(key, value; request.params) { string html = std.string.format(trtd%s/td td%s/td/tr, key, value); request.send(html); } request.send(/table); }); // wait until forever return fastcgi.exec(); }
Re: phobos config issue
Try using dmd -v file.d to see what actually going on there.
Re: Overloading static methods
Quote: Steven Schveighoffer An example I gave in the bug report just now is File. Imagine you have a File struct, and want to have an open method: struct File { static File open(string fname); } However, now this is valid code: File f; // here's the problem! f.open(fname); // does not do what you think it does... Yes, but why is he able to get an instance of File? The Designer of File should have rather used a class and disallow to create any instance of it. (@disable this) If instantiation should be only possible through a static function, then implement a private constructor or disable it. Quote: Andrei Alexandrescu I'll note that calls of static methods for instances has been a boon to generic programming in C++. People could call a method and it was up to the implementation whether it was static or not. This is a D feature. It's up to the designer to implement it static or non-static way. You don't have to care about, just call it.
Re: Liskov principle and unittest
class Superclass { abstract int do_some_stuff(); abstract int do_some_other_stuff(); } class Foo1 : Superclass class Foo2 : Superclass class Foo3 : Superclass unittest { // get an instance of all classes Superclass[] instances = [new Foo1(), new Foo2(), new Foo3()]; // test their behavoir foreach(instance; instances) { assert(instance.do_some_stuff() 0, whoops!); assert(instance.do_some_other_stuff() 100, whoops!); } }
Re: Why do we have transitive const, again?
I don't see why immutability has anything to do with constness... would you mind clarifying? Why does having transitive immutable also imply that we /must/ have transitive const? One man's variable is other man's const. foobar(const(char)[] data) { } immutable(char)[] data = ; foobar(data);