Re: It makes me sick!
On 07/26/2017 09:20 PM, FoxyBrown wrote: >> Somebody else had the same problem which they solved by removing >> "entire dmd": >> >> http://forum.dlang.org/thread/ejybuwermnentslcy...@forum.dlang.org >> >> Ali > > Thanks, that was it. So I guess I have to delete the original dmd2 dir > before I install each time... didn't use to have to do that. Normally, it shouldn't be necessary. The splitting of the datetime package[1] had this effect but I'm not sure why the installation process can't take care of it. Ali [1] http://dlang.org/changelog/2.075.0.html#split-std-datetime
Re: It makes me sick!
On Thursday, 27 July 2017 at 03:41:06 UTC, Ali Çehreli wrote: On 07/26/2017 08:34 PM, FoxyBrown wrote: Knowing that every time I upgrade to the latest "official" D compiler I run in to trouble: Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime8toStringMxFNbNfZAya (const(nothrow @safe immutable(char)[] function()) std.datetime.SysTime.toString) Win32\Debug DMD\test.obj(test) Somebody else had the same problem which they solved by removing "entire dmd": http://forum.dlang.org/thread/ejybuwermnentslcy...@forum.dlang.org Ali Thanks, that was it. So I guess I have to delete the original dmd2 dir before I install each time... didn't use to have to do that.
Re: It makes me sick!
On 07/26/2017 08:34 PM, FoxyBrown wrote: Knowing that every time I upgrade to the latest "official" D compiler I run in to trouble: Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime8toStringMxFNbNfZAya (const(nothrow @safe immutable(char)[] function()) std.datetime.SysTime.toString) Win32\Debug DMD\test.obj(test) Somebody else had the same problem which they solved by removing "entire dmd": http://forum.dlang.org/thread/ejybuwermnentslcy...@forum.dlang.org Ali
Re: It makes me sick!
And yes, I'm using the correct phobos(the one that came with dmd2).
It makes me sick!
Knowing that every time I upgrade to the latest "official" D compiler I run in to trouble: Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime8toStringMxFNbNfZAya (const(nothrow @safe immutable(char)[] function()) std.datetime.SysTime.toString) Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime6toHashMxFNaNbNiNfZk (const(pure nothrow @nogc @safe uint function()) std.datetime.SysTime.toHash) Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime8opEqualsMxFNaNbNfKxS3std8datetime7SysTimeZb (const(pure nothrow @safe bool function(ref const(std.datetime.SysTime))) std.datetime.SysTime.opEquals) Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3std8datetime7SysTime8__xopCmpFKxS3std8datetime7SysTimeKxS3std8datetime7SysTimeZi (int std.datetime.SysTime.__xopCmp(ref const(std.datetime.SysTime), ref const(std.datetime.SysTime))) Win32\Debug DMD\test.obj(test) Error 42: Symbol Undefined _D3gtk3All12__ModuleInfoZ (gtk.All.__ModuleInfo) \GtkD\x86\gtkd.lib(AboutDialog) Error 42: Symbol Undefined _D3std6format64__T14formatIntegralTS3std5array17__T8AppenderTAyaZ8AppenderTmTaZ14formatIntegralFNaNbNfS3std5array17__T8AppenderTAyaZ8AppenderxmKxS3std6format18__T10FormatSpecTaZ10FormatSpeckmZv (pure nothrow @safe void std.format.formatIntegral!(std.array.Appender!(immutable(char)[]).Appender, ulong, char).formatIntegral(std.array.Appender!(immutable(char)[]).Appender, const(ulong), ref const(std.format.FormatSpec!(char).FormatSpec), uint, ulong)) \GtkD\x86\gtkd.lib(AboutDialog) Error 42: Symbol Undefined _D3std5stdio6stderrS3std5stdio4File (std.stdio.File std.stdio.stderr) \GtkD\x86\gtkd.lib(Implement) Error 42: Symbol Undefined _D3std6format64__T14formatUnsignedTS3std5array17__T8AppenderTAyaZ8AppenderTmTaZ14formatUnsignedFNaNbNfS3std5array17__T8AppenderTAyaZ8AppendermKxS3std6format18__T10FormatSpecTaZ10FormatSpeckbZv (pure nothrow @safe void std.format.formatUnsigned!(std.array.Appender!(immutable(char)[]).Appender, ulong, char).formatUnsigned(std.array.Appender!(immutable(char)[]).Appender, ulong, ref const(std.format.FormatSpec!(char).FormatSpec), uint, bool)) Error: linker exited with status 8 Building Win32\Debug DMD\test.exe failed! I recompiled gtkD with the new compiler, same result. My code was working before the upgrade just fine and I did not change anything.
DDox and filters.
I am trying to build my projects documentation via the ddox system via dub. It seems that my modules are being documented and then filtered out. Ironically for a documentation system there isn't a lot of documentation. What is the minimum I need in order for documentation to show up? how do I control the filter options.
Re: I feel the dynamic array .sizeof property is kind of a bait and switch
On Wednesday, 26 July 2017 at 16:27:57 UTC, WhatMeWorry wrote: On Wednesday, 26 July 2017 at 02:31:33 UTC, Mike Parker wrote: With static arrays, the memory for the elements if part of the array itself, so it is counted in the size. For dynamic arrays, it is not. For .sizeof to report the size of the allocated memory would be incorrect. OK, Then I assume the critical thing is that dynamic arrays memory is not part of the array itself. But is this a deal breaker? A deal breaker for what? For making sizeof return the amount of memory allocated? Yes. It's the same behavior in C and C++: float verts[3]; assert(sizeof(verts) == (sizeof(float) * 3)); float *verts = malloc(sizeof(float)*3); assert(sizeof(verts) == sizeof(void*));
Re: Why can't typeof() be used in member method?
On Wednesday, 26 July 2017 at 19:06:24 UTC, Andre Pany wrote: On Wednesday, 26 July 2017 at 17:04:59 UTC, Adam D. Ruppe wrote: On Wednesday, 26 July 2017 at 16:50:35 UTC, Andre Pany wrote: [...] FYI, you shouldn't use .stringof here. Just use `T` instead of `T.stringof`. [...] Thank you so much! Kind regards André There's another method for such a check. mixin(`static if (!is(typeof(T.`~p.name~`
Re: Why can't typeof() be used in member method?
On Wednesday, 26 July 2017 at 17:04:59 UTC, Adam D. Ruppe wrote: On Wednesday, 26 July 2017 at 16:50:35 UTC, Andre Pany wrote: [...] FYI, you shouldn't use .stringof here. Just use `T` instead of `T.stringof`. [...] Thank you so much! Kind regards André
Re: Why structs and classes instanciations are made differently ?
On 07/26/2017 02:54 AM, Houdini wrote: On Tuesday, 25 July 2017 at 17:16:00 UTC, Kagamin wrote: On Tuesday, 25 July 2017 at 15:56:45 UTC, Houdini wrote: Yes, but it isn't the default way in C++ to do dynamic instanciation. https://github.com/isocpp/CppCoreGuidelines this? It's only 2 years old. The new operator predates it by decades. I meant : When you need to instantiate a class, you usually do : MyClass a; and not : MyClass* a = new MyClass(); You're in a value model. That's my experience as well. However, stack class objects are rare and to repeat Steven, it comes with the problem of slicing. Only after learning D that I realized there were two kinds of C++ types in my code: value types and reference types, latter of which I've achieved with boost::shared_ptr. So, I think D's separation is the right choice. However, classes are unnecessarily expensive due to that 'monitor' member and carry the mistakes of OOP models adopted by Java, C++, and others. I say this under the influence of open multi-methods[1] and anemic domain models[2]. Ali [1] http://forum.dlang.org/thread/cigbfrgipbokyetsk...@forum.dlang.org [2] https://www.meetup.com/D-Lang-Silicon-Valley/events/228027468/
Re: Why structs and classes instanciations are made differently ?
On Monday, 24 July 2017 at 17:42:30 UTC, Steven Schveighoffer wrote: On 7/24/17 11:45 AM, Houdini wrote: On Monday, 24 July 2017 at 15:41:33 UTC, Steven Schveighoffer wrote: Because types with inheritance generally don't work right if you pass by value (i.e. the slicing problem). structs don't support inheritance or virtual functions, so they can be safely passed by value. But in C++, we pass them by reference also to avoid copies (const &). The potential polymorphic usage is not the only point to consider. In C++ class and struct are pretty much interchangeable, so technically, class is a wasted keyword for default visibility. In D, I would use classes for any time I need polymorphism, and use structs otherwise. -Steve It has also the nice property that porting code from Java/C# is actually really easy when using classes as it has more or less the same semantic. When porting code from C and C++ it is often better to use structs.
Re: I feel the dynamic array .sizeof property is kind of a bait and switch
On Wednesday, 26 July 2017 at 02:32:07 UTC, Adam D. Ruppe wrote: I've hand rolled a function which is working for me currently, but with my coding ability, I'd feel much safer with something official :) You could also do (cast(ubyte[]) array).length. This was my (way over complicated) attempt at the same thing. I'll blame my verbosity because I was trying to teach myself about templates and constraints at the time :) /+ There is a special type of array which acts as a wildcard that can hold arrays of any kind, declared as void[]. The .length of a void array is the length of the data in bytes rather than the number of elements in its original type. " +/ int arrayByteSize(T)(T someArray) if (isDynamicArray!(T)) { ubyte[] arr = cast(ubyte[]) someArray; return cast(int) arr.length; } It just seems like something this basic regarding dynamic arrays should just be built-in. What are you using it for? glBufferData(GL_ARRAY_BUFFER, vertices.arrayByteSize, vertices.ptr, GL_STATIC_DRAW); I find that openGL uses array buffers all over the place. I just keep going back to the idea that such low level functionality should be inherent in either the language or Phobos. If that is even possible.
Re: How to make autocompletion for IDE?
On Wednesday, 26 July 2017 at 07:41:20 UTC, Andrea Fontana wrote: Did you try with [1]? [1] http://forum.dlang.org/post/okktlu$2bin$1...@digitalmars.com Thank you, interesting. But I'm afraid it is not enough.
Re: GtkD on android?
On 25-07-17 20:06, Joakim wrote: On Saturday, 22 July 2017 at 18:59:44 UTC, FoxyBrown wrote: With LDC's new ability to do android/arm, we are missing the ability to do GUI's? Can any of the current D solutions work such as GtkD or QtD? I'm looking for something somewhat lightweight, easy to use(I find GtkD a bit funky but it does seem to work and is relatively easy once one gets through the basics). I think having a GUI builder is crucial though as it makes it so much easier in the long run. Glade is a bit funky but functional and works. Ideally I'd like to be able to make portable apps that just work across the board(mac, linux, windows, android) without much hassle. Mike said maybe later, when I asked him in January: http://forum.dlang.org/post/o4rq0i$dur$1...@digitalmars.com In the meantime, you can try DlangUI, as Seb pointed out, but I get the impression it's not touch-optimized, just like Gtk. And if you want something lightweight, the complete GTK stack is probably not what you are looking for. -- Mike Wey
Re: Bug in File.byRecord ?
On 07/26/2017 04:51 AM, closescreen wrote: > I have a file with empty lines: 2,3 and 5,6 > > filename.csv (with linenumbers for better view in this message) > 1>Joe,Carpenter,30 > 2> > 3> > 4>Fred,Blacksmith,40 > 5> > 6> > > Now, if I run: > rdmd > --eval='"filename.csv".File.byRecord!(string,string,int)("%s,%s,%d").writeln' > > > It prints: > > [Tuple!(string, string, int)("Joe", "Carpenter", 30), > Tuple!(string, string, int)("Joe", "Carpenter", 30), > Tuple!(string, string, int)("Joe", "Carpenter", 30), > Tuple!(string, string, int)("Fred", "Blacksmith", 40), > Tuple!(string, string, int)("Fred", "Blacksmith", 40), > Tuple!(string, string, int)("Fred", "Blacksmith", 40)] > > It happens because code in > > https://github.com/dlang/phobos/blob/master/std/stdio.d#L297 > > not checks return value after call formattedRead. > > Is this a bug? Yes, I think it's a bug. Ali
Re: Why can't typeof() be used in member method?
On Wednesday, 26 July 2017 at 16:50:35 UTC, Andre Pany wrote: mixin(`static if (!__traits(compiles, typeof(`~T.stringof~`.`~p.name~`))) { ... } FYI, you shouldn't use .stringof here. Just use `T` instead of `T.stringof`. Creating new class for checking whether the class has a specific member is not possible in my scenario, as a DLL call is involved and I need the result (member available) as condition for static if. This doesn't *actually* create a new class, it just compiles as if you would to make sure it has a valid `this` for it in the type system. You could also use `typeof(TBounds.init.Left)`, which is actually even better than `new` since it doesn't require the constructor arguments. But in either case, that code isn't actually run, it just looks for the non-static member function. Due you think typeof should work within member methods and I should file an issue? I'm not sure... I could go either way on it since there is a reasonable answer here (int), but since it is non-static, trying to use it in an actual expression IS an error so it makes sense for typeof(error) to also be an error...
Re: Why can't typeof() be used in member method?
On Wednesday, 26 July 2017 at 14:05:12 UTC, Adam D. Ruppe wrote: On Wednesday, 26 July 2017 at 13:51:05 UTC, Andre Pany wrote: How can I fix this issue? I would just do typeof((new TBounds).Left) m; so then it is clear that you want a non-static member. In my productive scenario I try to check whether a class (TLabel) has a specific member ("Margins.Left", "TextSettings.Font.Size"). mixin(`static if (!__traits(compiles, typeof(`~T.stringof~`.`~p.name~`))) { ... } This coding is within a member method and due to the issue with typeof it is failing. Creating new class for checking whether the class has a specific member is not possible in my scenario, as a DLL call is involved and I need the result (member available) as condition for static if. Due you think typeof should work within member methods and I should file an issue? Kind regards André
Re: I feel the dynamic array .sizeof property is kind of a bait and switch
On Wednesday, 26 July 2017 at 02:31:33 UTC, Mike Parker wrote: On Wednesday, 26 July 2017 at 02:24:06 UTC, WhatMeForget wrote: [...] Because .sizeof has nothing to do with how many elements are in the array. It tells you how much space the array itself takes up. Totally agree. .length returns the the number of array elements. With static arrays, the memory for the elements if part of the array itself, so it is counted in the size. For dynamic arrays, it is not. For .sizeof to report the size of the allocated memory would be incorrect. OK, Then I assume the critical thing is that dynamic arrays memory is not part of the array itself. But is this a deal breaker?
Re: dub and hierarchies of packages
On Wednesday, 26 July 2017 at 14:05:09 UTC, Jean-Louis Leroy wrote: I have a package hierarchy (here https://github.com/jll63/openmethods.d/blob/master/dub.sdl) and I would like to 'dub run' or 'dub test' everything. Is there a recursive mode that I've missed? I don't think there is one. But would be useful! Secondly, I have buildTypes that I would like to use in all the packages (like here https://github.com/jll63/openmethods.d/blob/master/tests/misc/dub.sdl#L9). I would like to avoid repeating it in every dub.sdl. I tried putting the buildTypes in the root dub.sdl and defining my subpackages there (in spite of the warning against doing that) in the hope that the buildTypes would be globally available, but no. Is there a way of making the subpackages inherit stuff from their parent? Or some sort of sdl #include or 'import'? I think in DUB packages inherit flags from their dependencies when --combined is used. You could maybe use a fake dependency to insert the right "dflags" or "versions" for your particular build type. Something that also changed in the past is adding the new build type to DUB in the case it's a generic enough need.
Re: Cast to subclass in the dmd compiler
On Wednesday, 26 July 2017 at 06:50:21 UTC, Jacob Carlborg wrote: For Expression, there's a field called "op" that indicates what kind of expression it is, which can used in combination with a cast. Thank you for hint!
Re: Why can't typeof() be used in member method?
On Wednesday, 26 July 2017 at 13:51:05 UTC, Andre Pany wrote: How can I fix this issue? I would just do typeof((new TBounds).Left) m; so then it is clear that you want a non-static member.
dub and hierarchies of packages
Hi, I am quite happy with dub, the little package manager that could :) Now two questions or suggestions. I have a package hierarchy (here https://github.com/jll63/openmethods.d/blob/master/dub.sdl) and I would like to 'dub run' or 'dub test' everything. Is there a recursive mode that I've missed? Secondly, I have buildTypes that I would like to use in all the packages (like here https://github.com/jll63/openmethods.d/blob/master/tests/misc/dub.sdl#L9). I would like to avoid repeating it in every dub.sdl. I tried putting the buildTypes in the root dub.sdl and defining my subpackages there (in spite of the warning against doing that) in the hope that the buildTypes would be globally available, but no. Is there a way of making the subpackages inherit stuff from their parent? Or some sort of sdl #include or 'import'?
Why can't typeof() be used in member method?
Hi, I try to track down why some complex logic is not working. I think the root issue is that typeof() is not working in member methods. I reduced it to following example: app.d(16): Error: this for Left needs to be type TBounds not type app.A Failed: ["dmd", "-v", "-o-", "app.d", "-I."] class TBounds { @property float Left() {return 0.0;} } class A { static void test() { typeof(TBounds.Left) m; } void test2() { typeof(TBounds.Left) m; } } void main() {} How can I fix this issue? Kind regards André
Re: Get UDA of unit tests during Runtime.moduleUnitTester
On Wednesday, 26 July 2017 at 06:47:20 UTC, Jacob Carlborg wrote: On 2017-07-26 05:27, Matthew Remmel wrote: [...] Unless you want to go with the approach Seb suggested, using unit-threaded, you need to recursively iterate the module to get all aggregates using __traits(allMembers) then use __traits(getUnitTests) for each aggregate to get all unit tests. [...] That's not possible, the UDAs are lost after compile time. Also, all the unit tests block are combined into one function per module, which is what Runtime.moduleUnitTester is running. The separate unit test blocks are gone at runtime so there's nothing to connect the UDAs to. Thanks for the info, I'll look into the threaded unit test library and see what they are doing, and how. -Matt
Bug in File.byRecord ?
I have a file with empty lines: 2,3 and 5,6 filename.csv (with linenumbers for better view in this message) 1>Joe,Carpenter,30 2> 3> 4>Fred,Blacksmith,40 5> 6> Now, if I run: rdmd --eval='"filename.csv".File.byRecord!(string,string,int)("%s,%s,%d").writeln' It prints: [Tuple!(string, string, int)("Joe", "Carpenter", 30), Tuple!(string, string, int)("Joe", "Carpenter", 30), Tuple!(string, string, int)("Joe", "Carpenter", 30), Tuple!(string, string, int)("Fred", "Blacksmith", 40), Tuple!(string, string, int)("Fred", "Blacksmith", 40), Tuple!(string, string, int)("Fred", "Blacksmith", 40)] It happens because code in https://github.com/dlang/phobos/blob/master/std/stdio.d#L297 not checks return value after call formattedRead. Is this a bug? Or I not understand something?
Re: Why structs and classes instanciations are made differently ?
On Tuesday, 25 July 2017 at 17:16:00 UTC, Kagamin wrote: On Tuesday, 25 July 2017 at 15:56:45 UTC, Houdini wrote: Yes, but it isn't the default way in C++ to do dynamic instanciation. https://github.com/isocpp/CppCoreGuidelines this? It's only 2 years old. The new operator predates it by decades. I meant : When you need to instantiate a class, you usually do : MyClass a; and not : MyClass* a = new MyClass(); You're in a value model. If you find anything in Cpp Guidelines against that, I am interested.
Re: Crypto.lib and ssl.lib for Win32
On Tuesday, 25 July 2017 at 21:51:39 UTC, Adam D. Ruppe wrote: On Tuesday, 25 July 2017 at 12:11:08 UTC, MGW wrote: Where can I find the ready made for usage or how to create cryptro.lib and ssl.lib for Windows 32 that are necessary for my project? Do you have the crypto.dll and ssl.dll? If so, implib can make the lib files. If you don't have implib, email the dlls to me and I'll get it to you (destructiona...@gmail.com) Thank you for your offer! I didn`t find crypto.dll and ssl.dll files for Win32 with the necessary list of export functions. but there`re files libssl32.dll and libeay32.dll (from OpenSSL for Windows) which have the necessary export functions. Can I use them instead of crypto.dll and ssl.dll? Is it possible to rename libssl32.dll to ssl.dll? One more question: Was the module http2.d check and did it operate in Win32? I understand that it works in Linux but I really need it working in Win32.
Re: How to make autocompletion for IDE?
On Tuesday, 25 July 2017 at 10:45:38 UTC, unDEFER wrote: On Tuesday, 25 July 2017 at 10:35:14 UTC, Andrea Fontana wrote: If you want to add UFCS suggestions to DCD it would be useful for your project and all other IDEs too! Andrea Thank you, I will think. But if it was easy, authors self would do it :-) Did you try with [1]? [1] http://forum.dlang.org/post/okktlu$2bin$1...@digitalmars.com