[Issue 18618] templated functions should in general have their attributes inferred
https://issues.dlang.org/show_bug.cgi?id=18618 --- Comment #2 from Carsten Blüggel--- (In reply to Jonathan M Davis from comment #1) > Templated functions should have their attributes inferred when whether > attributes make sense depend on the template arguments (which the often do). > However, if the attributes don't depend on the template arguments, then they > really should be explicit. Whether any of the ones listed should have > attributes inferred which currently are explicit, I don't know (I'd have to > study them to know), and it's quite possible that all of the attributes > listed here should be removed, but I don't think that it's a good policy to > just not put attributes on templated functions. Whether they should be there > or not depends on whether they depend on the template arguments. Your guideline is new for me (but makes sense to me). Please, add this to https://dlang.org/dstyle.html, which "misguided" me. --
[Issue 18282] [Scope][DIP1000]Assignment of local variable to `scope` variable not recognized by compiler
https://issues.dlang.org/show_bug.cgi?id=18282 --- Comment #7 from Walter Bright--- https://github.com/dlang/dmd/pull/8045 --
When is copy assignment @safe to use when the left-hand-side is an undefined l-value?
Given an uninitialized (undefined content from, for instance, malloc) value `x` of type `T`, when is it @safe to initalize `x` with a simple assignment such as x = y in contrast to emplace(, y); ? My current guess is when hasElaborateCopyConstructor!T is `false`. Is this always correct? I'm asking because I want the following function to work correctly for all types including default-uncopyable container types (that require explicit call to .dup) private static void duplicateEmplace(T)(const scope ref T src, scope ref T dst) @system { import std.conv : emplace; import std.traits : hasElaborateCopyConstructor, isCopyable, isBasicType; static if (!hasElaborateCopyConstructor!T) { import std.traits : isInstanceOf; static if (is(T == class) || is(T == string)) { dst = cast(T)src; } else static if (isBasicType!T || isInstanceOf!(Nullable, T)) // `Nullable` types cannot be emplaced { dst = src; } else { emplace(, cast(Unqual!T)src); } } else static if (__traits(hasMember, T, "dup")) { // TODO fix when emplace can handle uncopyable types emplace(); dst = src.dup; } else { static assert(0, T.stringof ~ " is neither copyable or dupable"); } }
[Issue 18618] templated functions should in general have their attributes inferred
https://issues.dlang.org/show_bug.cgi?id=18618 Jonathan M Davischanged: What|Removed |Added CC||issues.dl...@jmdavisprog.co ||m --- Comment #1 from Jonathan M Davis --- Templated functions should have their attributes inferred when whether attributes make sense depend on the template arguments (which the often do). However, if the attributes don't depend on the template arguments, then they really should be explicit. Whether any of the ones listed should have attributes inferred which currently are explicit, I don't know (I'd have to study them to know), and it's quite possible that all of the attributes listed here should be removed, but I don't think that it's a good policy to just not put attributes on templated functions. Whether they should be there or not depends on whether they depend on the template arguments. --
[Issue 18618] templated functions should in general have their attributes inferred
https://issues.dlang.org/show_bug.cgi?id=18618 Carsten Blüggelchanged: What|Removed |Added CC||chi...@posteo.net --
Re: CTFE and -betterC
Le 16/03/2018 à 22:58, Xavier Bigand a écrit : Le 15/03/2018 à 01:09, Flamaros a écrit : On Wednesday, 14 March 2018 at 01:17:54 UTC, rikki cattermole wrote: You will still need DllMain, that is a platform requirement. I am not sure about that because when DllAnalyser don't see it in the opengl32.dll from the system32 directory. And the documentation indicate that it is optional. I finally choose to put the entry points generation in a sub-project that put them in a d file, like that it is easier to make the CTFE working and will be much better for the debugging and compilation time. So I have also some few other questions : - Is it a bug that ctRegex doesn't with the return of allMembers? - What is the status of the new CTFE engine? - Will CTFE be able to write files or expose a way to see to resulting generated code for a debug purpose? - Is there a reason why CTFE is impacted by the -betterC option? I actually found token strings, but I can't figure out how to cascade them, it is even possible? I tried things like that : enum loadSystemSymbolsCode = q{ version (Windows) { extern (Windows) void loadSytemSymbols() { import core.sys.windows.windows; immutable string dllFilePath = "C:/Windows/System32/opengl32.dll"; auto hModule = LoadLibraryEx(dllFilePath, null, 0); if (hModule == null) { return; } writeln(dllFilePath ~ " loaded."); "%SYSTEM_BINDINGS%" } } }; enum moduleCode = q{ module api_entry; import std.stdio : writeln; import derelict.util.wintypes; export extern (C) { mixin(loadSystemSymbolsCode); } }; string getLoadSystemSymbolsCode(string bindinsCode)() { return loadSystemSymbolsCode.replace("%SYSTEM_BINDINGS%", bindinsCode); } string getModuleCode(string loadSystemSymbolsCode)() { return moduleCode.replace("%LOAD_SYSTEM_SYMBOLS%", loadSystemSymbolsCode); } voidmain() { import std.stdio : File; auto file = File("../opengl32/src/api_entry.d", "w"); file.writeln( getModuleCode!( getLoadSystemSymbolsCode!("test;")()) ); } Is there some materials for learning to do this kind of things with CTFE? I feel my self little stupid, I don't need the " in the token string with the %WordToReplace%. So I think that the magic will happen.
Re: D beyond the specs
On Friday, 16 March 2018 at 19:27:40 UTC, Walter Bright wrote: On 3/16/2018 4:44 AM, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? My old company's product, Zortech C++, was also very popular in Germany, England, and Japan. I don't know why. Most interesting! I'm not kidding. Is it 'wow it's from the US', or something else? Genuine question. I ain't asking for fun. There's more to business and technology than meets the eye.
Re: Shouldn't pureMalloc be @system instead of @trusted?
On Friday, March 16, 2018 22:58:13 ag0aep6g via Digitalmars-d wrote: > On 03/16/2018 10:22 PM, Nordlöw wrote: > > Shouldn't `pureMalloc` at > > > > https://dlang.org/library/core/memory/pure_malloc.html > > > > be @system instead of @trusted? > > You can only access the uninitialized memory with @system features: > casting the pointer or slicing it. So it's safe, because you can't do > anything unsafe with it in @safe code. And because it's @trusted, you know that you don't have to spend time figuring out if you're using it in an @safe way. You just have to spend the time figuring out if you're using the result in an @safe way so that you can mark that code with @trusted. Ultimately, I think that the question of how @trusted is used comes down to making it so that the programmer knows which code they need to examine to manually verify @safety - that and not marking anything as @trusted that isn't actually @safe. But returning something that can't be used in @safe code isn't necessary unsafe. - Jonathan M Davis
Re: D beyond the specs
On Friday, 16 March 2018 at 19:15:16 UTC, bachmeier wrote: The point is that there is no "fundamental" reason someone using a computer uses a qwerty keyboard. If you are to ask "what makes the qwerty keyboard the best choice for someone using a computer?" you are not going to have any luck finding the answer (or worse, you will find an answer after sufficient data mining). Similarly for programming language usage. There may have been perfectly good reasons for the early adopters of D, but it's not going to help to look for features of the D language that fit certain cultures better. It may be as simple as someone getting introduced to the D language because of a typo in a Google search. Your "fundamental" reasons are more like "technical" reasons than "economic" reasons. Should a large company buy qwerty keyboards or some other kind? Should a worker invest time in learning how to use a qwerty keyboard or some other kind? Those are questions of economic decision-making. The question that is relevant to decision-makers is rarely about "what keyboard layout is best." Rather it is, how much marginal benefit is there in investing time in learning to use a qwerty keyboard vs. another kind and what do I have to give up in order to obtain that benefit. If the marginal benefit of learning the standard keyboard layout is larger than some other kind and the cost is approximately the same, then everyone (except some iconoclasts) are going to learn qwerty. This sort of analysis applies to programming languages in exactly the same way. If I'm a company, do I build products using language X or language Y. If I'm a person, do I spend N hours learning language X or language Y (or do the next best thing you can do...March Madness?). What if I already know language X? Then it's pure marginal cost to learn language Y. C programmers don't just switch to D or Rust or whatever the moment they see it has some "technical" features that are better. That's not what we observe. The marginal benefit has to exceed the marginal cost.
Re: Vision document for H1 2018
On Friday, March 16, 2018 21:37:44 Void-995 via Digitalmars-d-announce wrote: > Every time I'm thinking that something is impossible to be > elegantly and/or easily done even in D - someone proves me wrong. > > And common, I just had that little spark of motivation to look > into DMD, what is my purpose in life now? Fan it into flames and go learn it so that you can fix or improve other stuff that might come up? ;) Of course, depending on what you know and are interested in, doing stuff like writing useful libraries and putting them up on code.dlang.org can be of huge benefit even if you never do anything for dmd, druntime, or Phobos. In some ways, that's probably our biggest need. But regardless, if you're interested in helping out the D ecosystem, there are plenty of options. - Jonathan M Davis
[Issue 6138] Using dirEntries and chdir() can have unwanted results
https://issues.dlang.org/show_bug.cgi?id=6138 Timothee Courchanged: What|Removed |Added OS|Windows |All Severity|normal |major --- Comment #8 from Timothee Cour --- ping: this is a serious bug note: i was OSX and the bug was reported on windows originally, so setting to All --
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 20:19:59 UTC, aberba wrote: On Friday, 16 March 2018 at 17:11:17 UTC, visitor wrote: On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? There's also gtkd sourceview : https://github.com/gtkd-developers/GtkD/tree/master/generated/sourceview I think you mean Gtk web view. It comes from WebKit. oh yes, my bad, misreading, i thought OP wanted syntax highlighting and stuff...
Re: Shouldn't pureMalloc be @system instead of @trusted?
On 03/16/2018 10:22 PM, Nordlöw wrote: Shouldn't `pureMalloc` at https://dlang.org/library/core/memory/pure_malloc.html be @system instead of @trusted? You can only access the uninitialized memory with @system features: casting the pointer or slicing it. So it's safe, because you can't do anything unsafe with it in @safe code.
Re: CTFE and -betterC
Le 15/03/2018 à 01:09, Flamaros a écrit : On Wednesday, 14 March 2018 at 01:17:54 UTC, rikki cattermole wrote: You will still need DllMain, that is a platform requirement. I am not sure about that because when DllAnalyser don't see it in the opengl32.dll from the system32 directory. And the documentation indicate that it is optional. I finally choose to put the entry points generation in a sub-project that put them in a d file, like that it is easier to make the CTFE working and will be much better for the debugging and compilation time. So I have also some few other questions : - Is it a bug that ctRegex doesn't with the return of allMembers? - What is the status of the new CTFE engine? - Will CTFE be able to write files or expose a way to see to resulting generated code for a debug purpose? - Is there a reason why CTFE is impacted by the -betterC option? I actually found token strings, but I can't figure out how to cascade them, it is even possible? I tried things like that : enum loadSystemSymbolsCode = q{ version (Windows) { extern (Windows) void loadSytemSymbols() { import core.sys.windows.windows; immutable string dllFilePath = "C:/Windows/System32/opengl32.dll"; auto hModule = LoadLibraryEx(dllFilePath, null, 0); if (hModule == null) { return; } writeln(dllFilePath ~ " loaded."); "%SYSTEM_BINDINGS%" } } }; enum moduleCode = q{ module api_entry; import std.stdio : writeln; import derelict.util.wintypes; export extern (C) { mixin(loadSystemSymbolsCode); } }; string getLoadSystemSymbolsCode(string bindinsCode)() { return loadSystemSymbolsCode.replace("%SYSTEM_BINDINGS%", bindinsCode); } string getModuleCode(string loadSystemSymbolsCode)() { return moduleCode.replace("%LOAD_SYSTEM_SYMBOLS%", loadSystemSymbolsCode); } voidmain() { import std.stdio : File; auto file = File("../opengl32/src/api_entry.d", "w"); file.writeln( getModuleCode!( getLoadSystemSymbolsCode!("test;")()) ); } Is there some materials for learning to do this kind of things with CTFE?
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 15:58:25 UTC, Steven Schveighoffer wrote: On 3/12/18 10:57 AM, Void-995 wrote: On Monday, 12 March 2018 at 10:38:57 UTC, bachmeier wrote: On Monday, 12 March 2018 at 05:02:31 UTC, Jonathan M Davis wrote: Now, I actually understand ranges and am very glad that they're there, but as a D newbie, they were annoying, because they were unfamiliar. Ranges are D's monads. The only thing missing is the burrito tutorials. I always thought the best spice in D is UFCS. If only there would be one for local symbols (but that needs either foundation's decision or I need to write my first DIP and do something instead of just crying silently into my sleeve). alias I(alias X) = X; void main() { int y = 5; int bar(int x) { return y * x; } // auto z = 6.bar; // error auto z = 6.I!bar; // OK } https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ -Steve Every time I'm thinking that something is impossible to be elegantly and/or easily done even in D - someone proves me wrong. And common, I just had that little spark of motivation to look into DMD, what is my purpose in life now?
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote: On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote: Are you sure that you are talking about phobos and not tango? :) I'm eager to find how I'm uninformed. Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. Do you know anything else in the .net library than LINQ where extension methods (somehow equivalent to UFCS) are abused? I thought that something happened in the .net world while I was asleep, that's why I just searched my local copy of .net core and there are exactly 198 extension methods. I would not call these "big". The Tango remark was just a pun (R.I.P.), since it looked 90% similar to .net. And what would make Tango unusable with UFCS? Is it not written in D? Last time I checked, .net Console was an enormous static class with three Stream objects behind the scenes. When I said that phobos looks like a mess compared to .net lib I referred especially to the poor choice of names (eg. RedBlackTree vs SortedDictionary) and lack of essential stuff (eg. happy to have levenshteinDistance built in, but I cannot sort correctly two strings in any other language than English).
[Issue 17772] Wrong C++ mangled names for templated functions
https://issues.dlang.org/show_bug.cgi?id=17772 Walter Brightchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=18582 --
[Issue 18582] C++ namespace mangling from multiple modules doesn't use sequence ids
https://issues.dlang.org/show_bug.cgi?id=18582 Walter Brightchanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=17772 --
[Issue 18582] C++ namespace mangling from multiple modules doesn't use sequence ids
https://issues.dlang.org/show_bug.cgi?id=18582 Walter Brightchanged: What|Removed |Added Keywords||betterC CC||bugzi...@digitalmars.com --
Re: Forwarding arguments through a std.algorithm.map
On Friday, 16 March 2018 at 20:39:33 UTC, Andrei Alexandrescu wrote: My knee-jerk reaction is that's a rather peculiar primitive to add to the standard library. -- Andrei I'm needing it for variadic equal...I'll put it as a private member in `equal`s template declaration for now.
Shouldn't pureMalloc be @system instead of @trusted?
Shouldn't `pureMalloc` at https://dlang.org/library/core/memory/pure_malloc.html be @system instead of @trusted? Because it returns uninitialized memory just like T x = void; does, which is not allowed in @safe code.
Re: Testing D database calls code for regression
On Friday, 16 March 2018 at 20:17:49 UTC, aberba wrote: How will you test D code which makes calls to database to detect bugs and regression. Unlike where you can inject data like assert (2+1 == 3), database interfacing code will be crazy... Or there's some mocking available for such cases. Especially when more features are developed on top. would type providers (https://docs.microsoft.com/en-us/dotnet/fsharp/tutorials/type-providers/) be posible with ctfe? that would be one way to test at compile time functions that use the db.
Re: Testing D database calls code for regression
On Fri, Mar 16, 2018 at 08:17:49PM +, aberba via Digitalmars-d-learn wrote: > How will you test D code which makes calls to database to detect bugs > and regression. Unlike where you can inject data like assert (2+1 == > 3), database interfacing code will be crazy... Or there's some mocking > available for such cases. Especially when more features are developed > on top. The usual way I do this is to decouple the code from the real database backend by templatizing the database driver. Then in my unittest I can instantiate the template with a mock database driver that only implements the bare minimum to run the test. For example, instead of: import database : Database; auto myQueryFunc(Args...)(Database db, Args args) { return db.query(...); } Do this: import database : Database; auto myQueryFunc(Db = database.Database, Args...)(Db db, Args args) { return db.query(...); } Then regular calls to myQueryFunc will call the real database backend, as usual. But in the unittest: unittest { struct FakeDb { auto query(...) { // mock implementation here } } FakeDb db; // test away assert(myQueryFunc(db, ...) == ... ); // uses FakeDb } This applies not only to database backends, but just about anything you need to insert mockups for. For example, for testing complicated file I/O, I've found it useful to do this: auto myFunc(File = std.stdio.File, Args...)(Args args) { auto f = File(...); // do stuff with f } unittest { struct FakeFile { this(...) { ... } // mockup here } assert(myFunc!FakeFile(...) == ... ); } Using this method, you can even create tests for error-handling, like a simulated filesystem that returns random (simulated) I/O errors, or exhibits various disk-full conditions (without actually filling up your real disk!), etc.. I've created tests for code that searches directories for files, by substituting a fake filesystem that contains pre-determined sets of files with content that only exist inside the unittest. This way, I can run these tests without actually modifying my real filesystem in any way. If you push this idea far enough, you might be able to write unittests for simulated syscalls, too. :-D (Maybe that's something we could do in druntime... :-P) T -- May you live all the days of your life. -- Jonathan Swift
[Issue 18622] New: Outdated information regarding link definition when generated by Visual D DLL project.
https://issues.dlang.org/show_bug.cgi?id=18622 Issue ID: 18622 Summary: Outdated information regarding link definition when generated by Visual D DLL project. Product: D Version: D2 Hardware: x86_64 OS: Windows Status: NEW Severity: trivial Priority: P1 Component: visuald Assignee: nob...@puremagic.com Reporter: alexanderheisterm...@gmail.com ; there's been a bug http://d.puremagic.com/issues/show_bug.cgi?id=3956 causing ; inconsistent naming for symbols with "export" specifier ; The workaround is to list the names in the EXPORT section translating the name to itself: ; EXPORTS ;Symbol Symbol This bug has been fixed years ago. Visual D shouldn't supported badly outdated d compilers. --
Re: interfacing c++ templates. Another c++-namespace issue?
On Fri, Mar 16, 2018 at 03:53:00PM -0400, Steven Schveighoffer via Digitalmars-d wrote: [...] > There was another namespace issue recently found: > > https://issues.dlang.org/show_bug.cgi?id=18582 > > But it looks like its different. When you compare: > > C++: > _ZN14some_namespace23some_templated_functionIiEEvv > > D: > _ZN23some_templated_functionIiE23some_templated_functionEv > > Something is wrong. Instead of the namespace, you get > "some_templated_function" as the namespace! [...] I wonder if the problem is caused by wrongly treating the template function as a D eponymous template instead of a C++ template? T -- Don't drink and derive. Alcohol and algebra don't mix.
Re: Forwarding arguments through a std.algorithm.map
On 03/16/2018 03:52 PM, Nordlöw wrote: On Saturday, 10 March 2018 at 21:31:41 UTC, ag0aep6g wrote: auto forwardMap(alias fun, Ts ...)(Ts things) { import std.meta: aliasSeqOf, staticMap; import std.range: iota; import std.typecons: Tuple; alias NewType(size_t i) = typeof(fun(things[i])); alias NewTypes = staticMap!(NewType, aliasSeqOf!(iota(things.length))); Tuple!NewTypes results; static foreach (i, thing; things) results[i] = fun(thing); return results; } Found a slightly compacter way without `iota` and `aliasSeqOf` and with (deprecated) string-lambda support and single-pass initialization using `= void` and `emplace`: /** Returns: `xs` forwarded through calls to `fun`. * * See also: https://forum.dlang.org/post/zjxmreegqkxgdzvih...@forum.dlang.org */ auto forwardMap(alias fun, Ts...)(Ts xs) { import std.meta : staticMap; alias MappedTypeOf(T) = typeof(fun(T.init)); alias NewTypes = staticMap!(MappedTypeOf, Ts); import std.typecons : Tuple; Tuple!NewTypes ys = void; import std.conv : emplace; import std.functional : unaryFun; alias fun_ = unaryFun!(fun); static foreach (immutable i, x; xs) { emplace([i], fun_(x)); } return ys; } I believe this should go into Phobos somewhere. Into std.typecons, std.meta or std.algorithm? My knee-jerk reaction is that's a rather peculiar primitive to add to the standard library. -- Andrei
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 18:35:14 UTC, Tony wrote: I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO? Well, this is not IO, but: public struct DivInt { public int quot; public int rem; } public static class Utility { public static DivInt Div(this int dividee, int divisor) { int quot; int rem; quot = Math.DivRem(dividee, divisor, out rem); //always round down if(rem < 0) { quot--; rem += divisor; } return new DivInt{quot = quot, rem = rem}; } } Could be used in some way like: int quotient; int remainder; if (true) { var divResult = (x + y).Div(ASlowFunction()); quotient = divResult.quot; remainder = divResult.rem; } If you say it sucks that one has to declare an utility class just to be nominally object-oriented, I agree.
[Issue 18198] @disable semantic not applied for the delete operator
https://issues.dlang.org/show_bug.cgi?id=18198 Basile B.changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #1 from Basile B. --- Because of https://github.com/dlang/dmd/pull/8042, which i believe will be merged soon or later, it's not even worth fixing this issue. --
Testing D database calls code for regression
How will you test D code which makes calls to database to detect bugs and regression. Unlike where you can inject data like assert (2+1 == 3), database interfacing code will be crazy... Or there's some mocking available for such cases. Especially when more features are developed on top.
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 17:11:17 UTC, visitor wrote: On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? There's also gtkd sourceview : https://github.com/gtkd-developers/GtkD/tree/master/generated/sourceview I think you mean Gtk web view. It comes from WebKit.
[Issue 18129] Function parameter 'scope' does not mean without @safe
https://issues.dlang.org/show_bug.cgi?id=18129 --- Comment #5 from John Hall--- Ah, you're right. It says "Errors for scope violations are only reported in @safe code." --
[Issue 18129] Function parameter 'scope' does not mean without @safe
https://issues.dlang.org/show_bug.cgi?id=18129 --- Comment #4 from Jonathan M Davis--- As I understand it, -dip1000 has no effect on code that isn't @safe. So, you're not going to have the compiler yelling at you over it if you're not using @safe. Either way, without -dip1000, scope on parameters only affects delegates and thus has no effect on the code posted here. --
[Issue 18129] Function parameter 'scope' does not mean without @safe
https://issues.dlang.org/show_bug.cgi?id=18129 --- Comment #3 from John Hall--- Jonathan, I was a little hesitant to say I was sure it was a duplicate of that one because I tried running it on run.dlang.org with the -dip1000 flag and it was still not giving a warning. --
Re: interfacing c++ templates. Another c++-namespace issue?
On 3/16/18 3:32 PM, Walter Bright wrote: On 3/16/2018 11:57 AM, Markus wrote: It seems like dmd doesn't care about the namespace of the template. Can someone confirm this as a bug? or am I doing something terrible wrong? :) Might check that this https://issues.dlang.org/show_bug.cgi?id=17772 is not the issue. See my comment in https://github.com/dlang/dmd/pull/7906 : "Fixing the T_ mangling is much more problematic, I don't know how to do that yet. This namespace issue is independent, so it is convenient to do it separately." There was another namespace issue recently found: https://issues.dlang.org/show_bug.cgi?id=18582 But it looks like its different. When you compare: C++: _ZN14some_namespace23some_templated_functionIiEEvv D: _ZN23some_templated_functionIiE23some_templated_functionEv Something is wrong. Instead of the namespace, you get "some_templated_function" as the namespace! -Steve
Re: Forwarding arguments through a std.algorithm.map
On Saturday, 10 March 2018 at 21:31:41 UTC, ag0aep6g wrote: auto forwardMap(alias fun, Ts ...)(Ts things) { import std.meta: aliasSeqOf, staticMap; import std.range: iota; import std.typecons: Tuple; alias NewType(size_t i) = typeof(fun(things[i])); alias NewTypes = staticMap!(NewType, aliasSeqOf!(iota(things.length))); Tuple!NewTypes results; static foreach (i, thing; things) results[i] = fun(thing); return results; } Found a slightly compacter way without `iota` and `aliasSeqOf` and with (deprecated) string-lambda support and single-pass initialization using `= void` and `emplace`: /** Returns: `xs` forwarded through calls to `fun`. * * See also: https://forum.dlang.org/post/zjxmreegqkxgdzvih...@forum.dlang.org */ auto forwardMap(alias fun, Ts...)(Ts xs) { import std.meta : staticMap; alias MappedTypeOf(T) = typeof(fun(T.init)); alias NewTypes = staticMap!(MappedTypeOf, Ts); import std.typecons : Tuple; Tuple!NewTypes ys = void; import std.conv : emplace; import std.functional : unaryFun; alias fun_ = unaryFun!(fun); static foreach (immutable i, x; xs) { emplace([i], fun_(x)); } return ys; } I believe this should go into Phobos somewhere. Into std.typecons, std.meta or std.algorithm?
[Issue 6931] scope parameter storage class not checked at all
https://issues.dlang.org/show_bug.cgi?id=6931 Jonathan M Davischanged: What|Removed |Added CC||sobaya...@gmail.com --- Comment #5 from Jonathan M Davis --- *** Issue 18129 has been marked as a duplicate of this issue. *** --
[Issue 18129] Function parameter 'scope' does not mean without @safe
https://issues.dlang.org/show_bug.cgi?id=18129 Jonathan M Davischanged: What|Removed |Added Status|NEW |RESOLVED CC||issues.dl...@jmdavisprog.co ||m Resolution|--- |DUPLICATE --- Comment #2 from Jonathan M Davis --- Without -dip1000, scope is ignored on parameters for everything other than delegates. DIP 1000 is expanding on scope to fully implement it for pointers and dynamic arrays and whatnot, but without DIP 1000, it does almost nothing. *** This issue has been marked as a duplicate of issue 6931 *** --
Re: User Stories: Funkwerk
On Wednesday, 14 March 2018 at 14:17:50 UTC, Mike Parker wrote: foreach(auto element: elements) ":" is C++ syntax
Re: Ecoji-d v1.0.0 is released - Base1024 using emojis
On 15/03/2018 19:45, Anton Fediushin wrote: $ dd if=test.raw | ./ecoji-d | gzip -c | wc -c 67108864 bytes (67 MB, 64 MiB) copied, 27.9972 s, 2.4 MB/s 32178275 # 48% improvement If you can compress random data to 52% of the original data, you should repeat this step until there is a single byte left.
Re: Short-circuit range counting algorithm?
On Friday, 16 March 2018 at 17:41:22 UTC, H. S. Teoh wrote: Given a forward range r, I want to test whether it has exactly n elements that satisfy some given predicate pred. Is it possible to do this using current Phobos algorithms such that it does not traverse more members of the range than necessary? The naïve solution `r.count!pred == n` walks the entire range, even though it may already have seen n+1 elements that satisfies pred, and therefore should already know that the answer must be false. T I've implemented these by hand as special cases of count named countsExactly, countsAtLeast, countsAtMost beginning at https://github.com/nordlow/phobos-next/blob/3682da65ecb8497946379b41d8027b8292c635a1/src/algorithm_ex.d#L1941
[Issue 18129] Function parameter 'scope' does not mean without @safe
https://issues.dlang.org/show_bug.cgi?id=18129 John Hallchanged: What|Removed |Added CC||john.michael.h...@gmail.com --- Comment #1 from John Hall --- This may be related to issue 6931 [1]. Regardless, I tried simpler and some more complex variations on what you did and also got the same result. [1] https://issues.dlang.org/show_bug.cgi?id=6931 --
Re: DConf 2018 - The touristy bits
On 3/16/2018 4:14 AM, Chris wrote: [...] Danke schoen!
Re: interfacing c++ templates. Another c++-namespace issue?
On 3/16/2018 11:57 AM, Markus wrote: It seems like dmd doesn't care about the namespace of the template. Can someone confirm this as a bug? or am I doing something terrible wrong? :) Might check that this https://issues.dlang.org/show_bug.cgi?id=17772 is not the issue. See my comment in https://github.com/dlang/dmd/pull/7906 : "Fixing the T_ mangling is much more problematic, I don't know how to do that yet. This namespace issue is independent, so it is convenient to do it separately."
Re: D beyond the specs
On 3/16/2018 4:44 AM, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? My old company's product, Zortech C++, was also very popular in Germany, England, and Japan. I don't know why.
Re: D beyond the specs
On Friday, 16 March 2018 at 16:18:55 UTC, jmh530 wrote: We use qwerty because that's what the first commercially successful typewriter used. When computers came about, they needed to get people to transition over. Keeping qwerty was the optimal decision because of marginal costs and marginal benefits, not just random decisions. Its creator didn't choose it randomly. He put the keys that were most common where it was easiest to get at them, but it jammed if people were typing too quickly so he made you type the most common letters with your left hand instead of right. Some people bring up the Dvorak keyboard, but the evidence that it was better was scant and the marginal benefit of switching was too small to justify the cost. The point is that there is no "fundamental" reason someone using a computer uses a qwerty keyboard. If you are to ask "what makes the qwerty keyboard the best choice for someone using a computer?" you are not going to have any luck finding the answer (or worse, you will find an answer after sufficient data mining). Similarly for programming language usage. There may have been perfectly good reasons for the early adopters of D, but it's not going to help to look for features of the D language that fit certain cultures better. It may be as simple as someone getting introduced to the D language because of a typo in a Google search.
Re: Short-circuit range counting algorithm?
On Fri, Mar 16, 2018 at 02:58:36PM -0400, Steven Schveighoffer via Digitalmars-d wrote: > On 3/16/18 2:07 PM, Seb wrote: > > On Friday, 16 March 2018 at 17:50:37 UTC, Andrei Alexandrescu wrote: > > > On 3/16/18 1:41 PM, H. S. Teoh wrote: > > > > Given a forward range r, I want to test whether it has exactly n > > > > elements that satisfy some given predicate pred. Is it possible > > > > to do this using current Phobos algorithms such that it does not > > > > traverse more members of the range than necessary? > > > > > > > > The naïve solution `r.count!pred == n` walks the entire range, > > > > even though it may already have seen n+1 elements that satisfies > > > > pred, and therefore should already know that the answer must be > > > > false. > > > > > > r.count!pred.walkLength(n) == n > > > > Shouldn't this be using filter (count is eager)? > > > > r.filter!pred.walkLength(n) == n > > r.filter!pred.walkLength(n + 1) == n [...] Aha, so the trick is the 2-argument overload of walkLength. That's what I was looking for. Thanks! And yes, it should be .walkLength(n+1) because otherwise you don't know if the actual count is >n. T -- Don't drink and derive. Alcohol and algebra don't mix.
Re: Vision document for H1 2018
On 03/16/2018 02:35 PM, Tony wrote: On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote: On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote: Are you sure that you are talking about phobos and not tango? :) I'm eager to find how I'm uninformed. Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO? It doesn't (last I used it), buy you CAN mark individual member functions to be usable UFCS-like. IIRC, I think it might have to be static member function. It's been awhile, so I don't remember it exactly, but it's something like this: class Bar {} class Foo { static void SomeFunc(extention Bar bar, int num) {...} } class MyApp { static void Run() { Bar bar = new Bar(); bar.SomeFunc(2); } }
Re: Short-circuit range counting algorithm?
On 3/16/18 2:07 PM, Seb wrote: On Friday, 16 March 2018 at 17:50:37 UTC, Andrei Alexandrescu wrote: On 3/16/18 1:41 PM, H. S. Teoh wrote: Given a forward range r, I want to test whether it has exactly n elements that satisfy some given predicate pred. Is it possible to do this using current Phobos algorithms such that it does not traverse more members of the range than necessary? The naïve solution `r.count!pred == n` walks the entire range, even though it may already have seen n+1 elements that satisfies pred, and therefore should already know that the answer must be false. r.count!pred.walkLength(n) == n Shouldn't this be using filter (count is eager)? r.filter!pred.walkLength(n) == n r.filter!pred.walkLength(n + 1) == n -Steve
interfacing c++ templates. Another c++-namespace issue?
Hi [template.cpp]: template void some_templated_function(); template<> void some_templated_function() {} [main.d]: extern(C++) { void some_templated_function(Type)(); } void main() { some_templated_function!int; } compilation: g++ -c template_with_ns.cpp dmd main.d template.o this WORKS! :) BUT, now I put all c++ stuff into a namespace [template_with_ns.cpp]: namespace some_namespace { template void some_templated_function(); template<> void some_templated_function() {} } [main_with_ns.d]: extern(C++, some_namespace) { void some_templated_function(Type)(); } void main() { some_templated_function!int; } DOES NOT compile undefined reference to `void some_templated_function()' nm main_with_ns.o _Z23some_templated_functionIiEvv nm template_with_ns.o _ZN14some_namespace23some_templated_functionIiEEvv It seems like dmd doesn't care about the namespace of the template. Can someone confirm this as a bug? or am I doing something terrible wrong? :) When I retry this with gdc it doesn't compile. Neither with namespace nor without: nm template.o: _Z23some_templated_functionIiEvv main.o: _ZN23some_templated_functionIiE23some_templated_functionEv The more I work with D, interfacing C++, the more I start to know "mangling" :D Have fun Markus
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? To the best of my knowledge, there is currently no job offer in D programming in France. It is not even required/highlighted as a second/bonus skill to apply for a job. Perhaps it is used within a research and development department of very few companies for very specific tasks but it's unheard of and the mentalities of top management won't change before long because we are a retarded population who needs a lot of safety nets and huge amounts of guarantees to actually to take action... Also, french citizens don't like taking financial and technological risks, now adopting D for profesionnal use is a big one. For example, to be hired full time as a Python programmer is possible for only 3-4 years and was regarded as an "exotic" language until now. I know it's sucks...
Re: Vision document for H1 2018
On Friday, 16 March 2018 at 15:04:21 UTC, Kagamin wrote: On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote: Are you sure that you are talking about phobos and not tango? :) I'm eager to find how I'm uninformed. Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it. I thought C# was like Java and does not allow free procedures. Can you give an example of C# procedural-style IO?
Re: dmd -unittest= (same syntax as -i)
On Friday, 16 March 2018 at 14:32:47 UTC, Dejan Lekic wrote: On Wednesday, 14 March 2018 at 22:04:50 UTC, Adam D. Ruppe wrote: [...] I guess it was me talking about it two days ago on IRC... [...] There are a bunch of alternative test runners on code.dlang.org. Obviously I prefer mine: http://code.dlang.org/packages/unit-threaded Atila
Re: Vision document for H1 2018
On Thursday, 15 March 2018 at 10:48:45 UTC, Radu wrote: You have to remember that the really big first client of betterC(++) was DMD, porting DMD from C++ was a big undertaking. Right now both DMD and LDC use a form of betterC, so it is critical to have it finalized. This is entirely wrong. DMD and LDC rely extern(C++), but this has nothing to do with -betterC whatsoever. Both compilers link and initialise the runtime as normal (and then disable the GC at runtime). — David
Re: Short-circuit range counting algorithm?
On Friday, 16 March 2018 at 17:50:37 UTC, Andrei Alexandrescu wrote: On 3/16/18 1:41 PM, H. S. Teoh wrote: Given a forward range r, I want to test whether it has exactly n elements that satisfy some given predicate pred. Is it possible to do this using current Phobos algorithms such that it does not traverse more members of the range than necessary? The naïve solution `r.count!pred == n` walks the entire range, even though it may already have seen n+1 elements that satisfies pred, and therefore should already know that the answer must be false. r.count!pred.walkLength(n) == n Shouldn't this be using filter (count is eager)? r.filter!pred.walkLength(n) == n
Re: D beyond the specs
On 03/16/2018 08:32 AM, Radu wrote: > Maybe the name has something to do with it :D Not about numerology, but for "priming" reasons I think names do have effect. For example, Germany's country letter is D. ;) Thinking back, the fact that my daughter's name starts with D may have a positive effect on my impression of D. (My son's name starts with D as well but in his case it was to match it to my daughter's name. :) ) Ali
Re: D beyond the specs
On 03/16/2018 09:18 AM, jmh530 wrote: > On Friday, 16 March 2018 at 16:02:07 UTC, bachmeier wrote: >> Much of programming language >> adoption involves choosing languages others are using Agreed. In my case, "others" have been people who I respected or happened to be my close friends. Over the years, I've become less prone to crowd influence (or they are so successful that I merely think so. :)) > Some people bring up the Dvorak keyboard, but the evidence that it was > better was scant and the marginal benefit of switching was too small to > justify the cost. I've switched to Dvorak I think 18 years ago when I started having aches on my arms. I can't argue that Dvorak was the reason because I changed two more things at the same time: split keyboard and Emacs for its word completion feature (so that I would type less). In the end I'm weirder because I use Dvorak... and Emacs... and D... and spaces... and no external monitor... and too many other things... :o) Ali
Re: Short-circuit range counting algorithm?
On 3/16/18 1:41 PM, H. S. Teoh wrote: Given a forward range r, I want to test whether it has exactly n elements that satisfy some given predicate pred. Is it possible to do this using current Phobos algorithms such that it does not traverse more members of the range than necessary? The naïve solution `r.count!pred == n` walks the entire range, even though it may already have seen n+1 elements that satisfies pred, and therefore should already know that the answer must be false. r.count!pred.walkLength(n) == n
Short-circuit range counting algorithm?
Given a forward range r, I want to test whether it has exactly n elements that satisfy some given predicate pred. Is it possible to do this using current Phobos algorithms such that it does not traverse more members of the range than necessary? The naïve solution `r.count!pred == n` walks the entire range, even though it may already have seen n+1 elements that satisfies pred, and therefore should already know that the answer must be false. T -- The early bird gets the worm. Moral: ewww...
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? There's also gtkd sourceview : https://github.com/gtkd-developers/GtkD/tree/master/generated/sourceview
Re: Forwarding arguments through a std.algorithm.map
On Saturday, 10 March 2018 at 21:31:41 UTC, ag0aep6g wrote: Not tested beyond `f(1, 2.3, "foo")`: auto forwardMap(alias fun, Ts ...)(Ts things) { import std.meta: aliasSeqOf, staticMap; import std.range: iota; import std.typecons: Tuple; alias NewType(size_t i) = typeof(fun(things[i])); alias NewTypes = staticMap!(NewType, aliasSeqOf!(iota(things.length))); Tuple!NewTypes results; static foreach (i, thing; things) results[i] = fun(thing); return results; } Thanks! I'll try to put together something...
Re: How to simplify nested ifs
On Tuesday, 13 March 2018 at 12:23:06 UTC, Ozan Süel wrote: if (source?pool?repository?directory?users) // do something That type of chain is sometimes referred to as a "train wreck" (see Law of Demeter). If this is a common lookup it could be: if (source && source.GotSomeUsers() )
Re: List of language deprecations
On Friday, 16 March 2018 at 16:01:18 UTC, Steven Schveighoffer wrote: https://dlang.org/deprecate.html Thanks!
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: [...] easy code readability, few keywords, well defined and predictable (ex. ebnf) well D is all - but that. i can't get anyone in our company to use it even for little stuff.
Re: D beyond the specs
On Friday, 16 March 2018 at 16:02:07 UTC, bachmeier wrote: Allow me to put on my economist hat and say you might be looking for explanations when none are required. Much of programming language adoption involves choosing languages others are using (see, well, any conversation about programming languages if you don't think it matters, or even the continued use of C++). There doesn't have to be a reason to settle on a particular language. Perfect example is the qwerty keyboard. There's nothing special about a qwerty keyboard. That is the arrangement of keys that some guy randomly chose many decades back. We continue to use qwerty because that's what we use - not for any particular reason. We use qwerty because that's what the first commercially successful typewriter used. When computers came about, they needed to get people to transition over. Keeping qwerty was the optimal decision because of marginal costs and marginal benefits, not just random decisions. Its creator didn't choose it randomly. He put the keys that were most common where it was easiest to get at them, but it jammed if people were typing too quickly so he made you type the most common letters with your left hand instead of right. Some people bring up the Dvorak keyboard, but the evidence that it was better was scant and the marginal benefit of switching was too small to justify the cost.
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? I've always been intrigued by the fact that it originated in the US but that it's in "the old world" that a lot of enthusiasts (and contributors) are found. This has been already discussed (a bit)... Follow answers from this message. https://forum.dlang.org/post/ylkfeeywaqgjppeiq...@forum.dlang.org
Re: D beyond the specs
On Friday, March 16, 2018 11:44:59 Chris via Digitalmars-d wrote: > Would it be possible to find out at DConf in Munich why exactly D > is so popular in Germany (my impression) and in other countries > of Europe (and that general post code) like France, Italy, GB, > Romania and Russia etc.? I've always been intrigued by the fact > that it originated in the US but that it's in "the old world" > that a lot of enthusiasts (and contributors) are found. It's just > because you would usually associate innovation with the "new > world", but in this particular case D must have struck a chord > with the old world. Is it marketing and economic / pragmatic > factors that lead to poor adoption rates (and sometimes outright > hostility) in the US. Maybe, but I think there's something in the > engineering approach and the concepts that "talks" to us in the > "old world". I think this is an interesting topic as regards both > culture and technology. Any technology is embedded in and the > product of a certain culture / way of thinking - and D seems to > be a special case. Hint: there's a Ph.D. in it ;) Walter mentioned at a dconf a while back that some of them had been discussing it, and they decided that it was because all of the cars in Germany have a sticker of the letter D on them (for Deutschland). :) - Jonathan M Davis
Re: D beyond the specs
On Friday, 16 March 2018 at 15:14:08 UTC, Chris wrote: On Friday, 16 March 2018 at 14:50:26 UTC, Paulo Pinto wrote: Well, Algol, Pascal, Oberon, Component Pascal, VHDL, Ada are all examples of programming languages successfully used in Europe, while having adoption issues on US. Even Delphi is still having regular conferences and magazine articles here in Germany. Now that's interesting, so maybe there is a pattern or a quality those languages have in common. Allow me to put on my economist hat and say you might be looking for explanations when none are required. Much of programming language adoption involves choosing languages others are using (see, well, any conversation about programming languages if you don't think it matters, or even the continued use of C++). There doesn't have to be a reason to settle on a particular language. Perfect example is the qwerty keyboard. There's nothing special about a qwerty keyboard. That is the arrangement of keys that some guy randomly chose many decades back. We continue to use qwerty because that's what we use - not for any particular reason.
Re: List of language deprecations
On 3/16/18 11:58 AM, Nordlöw wrote: Is there a list of language deprecations? I want to show my codings fellows how strong and modern D's view on deprecations are. https://dlang.org/deprecate.html -Steve
Re: Vision document for H1 2018
On 3/12/18 10:57 AM, Void-995 wrote: On Monday, 12 March 2018 at 10:38:57 UTC, bachmeier wrote: On Monday, 12 March 2018 at 05:02:31 UTC, Jonathan M Davis wrote: Now, I actually understand ranges and am very glad that they're there, but as a D newbie, they were annoying, because they were unfamiliar. Ranges are D's monads. The only thing missing is the burrito tutorials. I always thought the best spice in D is UFCS. If only there would be one for local symbols (but that needs either foundation's decision or I need to write my first DIP and do something instead of just crying silently into my sleeve). alias I(alias X) = X; void main() { int y = 5; int bar(int x) { return y * x; } // auto z = 6.bar; // error auto z = 6.I!bar; // OK } https://blog.thecybershadow.net/2015/04/28/the-amazing-template-that-does-nothing/ -Steve
List of language deprecations
Is there a list of language deprecations? I want to show my codings fellows how strong and modern D's view on deprecations are.
Re: D beyond the specs
On Friday, 16 March 2018 at 14:45:28 UTC, Guillaume Piolat wrote: On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? Made-up theory that probably isn't worth anything without measurements: In providing an improvement over C++, including more safety and GC, D (unwillingly) positionned itself being spiritual successor in the Wirth's family of language. And Niklaus Wirth was from Switzerland so _perhaps_ the nearby territory is already more favourable to alternatives native languages. Let the speculation begin! Huh, that's pretty much what I was going to say, particularly with Paulo always bringing up Oberon in here. :) Let me add to the theory: the US private fund-raising enviroment was quicker to take risks with such quick-and-dirty tech, which led to Sun and Microsoft pushing UNIX and Windows and C and C++ to global dominance. For example, the Silicon Valley investors, used to putting millions into chips, quickly starting dumping money into these software startups too: https://stratechery.com/2018/lessons-from-spotify/ The current wave of iOS/Android and Obj-c/Java is merely the next iteration from Silicon Valley. However, let me posit a change in the environment that now favors different kinds of tech. I'd argue open source is a much more powerful force these days than those prior factors. Rather than a single company driving a language or OS, you have to have many contributors, both companies and individuals, for open source or you'll get swamped by the crowd, which is why Android and Java/Swift have been mostly open-sourced. This led to the OSS scripting languages that focused on ease of use- python, ruby, etc.- and a race to the bottom, ie javascript and php. It's now leading to thoughtful attempts to dislodge C/C++: D, Nim, Rust, Swift, Crystal, etc. My point is that it appears that the time of local tech champions winning out is ending. With open source, all of us all over the world can now take part in building out the foundational tech. :)
Re: dmd -unittest= (same syntax as -i)
On 3/16/18 10:32 AM, Dejan Lekic wrote: On Wednesday, 14 March 2018 at 22:04:50 UTC, Adam D. Ruppe wrote: On Wednesday, 14 March 2018 at 21:22:01 UTC, Timothee Cour wrote: would a PR for `dmd -unittest= (same syntax as -i)` be welcome? so when this came up on irc earlier (was that you?) this was the first thought that came to my mind. I'd support it, tho I'm no decision maker. I guess it was me talking about it two days ago on IRC... Almost exclusively I need to run unittests only in the module I currently work on and it really makes no sense to run other unittests at that point of time (unless I explicitly want to). I would even go further to say that we basically need to be able to run particular unittest. What I do at the moment is that I developed this kind of practice to have a test_runner.d top-level module in every D project of mine that contains tests I do during the development of particular feature TDD style, and then once I am done, I move this code to appropriate unittest blocks in my final module... There are bunch of issues with existing support for unittests that could be solved to make unit-testing a really pleasant activity. You can do most of this via custom unit test handlers[1]. We could potentially add more features to unit testing in druntime, but the more we add, the more complex the code gets. -Steve [1] https://dlang.org/phobos/core_runtime.html#.Runtime.extendedModuleUnitTester
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? I've always been intrigued by the fact that it originated in the US but that it's in "the old world" that a lot of enthusiasts (and contributors) are found. It's just because you would usually associate innovation with the "new world", but in this particular case D must have struck a chord with the old world. Is it marketing and economic / pragmatic factors that lead to poor adoption rates (and sometimes outright hostility) in the US. Maybe, but I think there's something in the engineering approach and the concepts that "talks" to us in the "old world". I think this is an interesting topic as regards both culture and technology. Any technology is embedded in and the product of a certain culture / way of thinking - and D seems to be a special case. Hint: there's a Ph.D. in it ;) Here's a half-assed theory :P Maybe the name has something to do with it :D, Americans have always made fun about it, strong D jokes (no pun here) make it hard to talk about it with a straight face around your college dorm buddies. Also I assume no water cooler talks will go unnoticed when everyone talks about the D. Anyhow, it is interesting that, at least apparently, there are more people involved with Dlang in Europe.
Re: D beyond the specs
On Friday, 16 March 2018 at 14:50:26 UTC, Paulo Pinto wrote: Well, Algol, Pascal, Oberon, Component Pascal, VHDL, Ada are all examples of programming languages successfully used in Europe, while having adoption issues on US. Even Delphi is still having regular conferences and magazine articles here in Germany. Now that's interesting, so maybe there is a pattern or a quality those languages have in common. Maybe we care more about enforced code quality? :) Now, this an interesting point. Mind you, Python (forced indentation) is also a European language. "Quick and dirty" is more common in the US in the sense that they don't philosophize about things but just do them and see what happens (that's why they are often ahead of Europe when it comes to technology). There are loads of good ideas that never made it past the meetings, because they weren't "perfect" yet, while in the US they just did it and improved it later. Is this also the reason why D sometimes suffers from the "the perfect is the enemy of the good" syndrome? @Guillaume Theories are always made up, else they wouldn't be _theories_ ;)
[Issue 18478] Spurious "escapes a reference to local variable" error in function that does not return by reference
https://issues.dlang.org/show_bug.cgi?id=18478 Carsten Blüggelchanged: What|Removed |Added Keywords||rejects-valid, spec --- Comment #1 from Carsten Blüggel --- Another error example from phobos that appeared in master within the last ~24h: https://github.com/dlang/phobos/blob/master/std/exception.d make -f posix.mak std/exception.test (-dip1000 for that module; DMD64 master) std/exception.d(1243): Error: returning & i escapes a reference to local variable i excerpt from std/exception.d: /// Arrays (dynamic and static) @system unittest { int i; int[] slice = [0, 1, 2, 3, 4]; int[5] arr = [0, 1, 2, 3, 4]; int*[] slicep = []; <= line 1243 int*[1] arrp = []; ... assert( slicep[0].doesPointTo(i)); <= slicep usage assert(!slicep .doesPointTo(i)); <= slicep usage ... 1. This is @system code, allowed to escape whatever 2. There is no escape (commenting out slicep usages doesn't change error reported) --
Re: Vision document for H1 2018
On Thursday, 15 March 2018 at 16:03:14 UTC, rumbu wrote: Are you sure that you are talking about phobos and not tango? :) I'm eager to find how I'm uninformed. Tango doesn't use UFCS, while phobos and .net framework are big on extension methods. Also tango uses object oriented console IO, while phobos and .net framework use procedural style for it.
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? I've always been intrigued by the fact that it originated in the US but that it's in "the old world" that a lot of enthusiasts (and contributors) are found. It's just because you would usually associate innovation with the "new world", but in this particular case D must have struck a chord with the old world. Is it marketing and economic / pragmatic factors that lead to poor adoption rates (and sometimes outright hostility) in the US. Maybe, but I think there's something in the engineering approach and the concepts that "talks" to us in the "old world". I think this is an interesting topic as regards both culture and technology. Any technology is embedded in and the product of a certain culture / way of thinking - and D seems to be a special case. Hint: there's a Ph.D. in it ;) Well, Algol, Pascal, Oberon, Component Pascal, VHDL, Ada are all examples of programming languages successfully used in Europe, while having adoption issues on US. Even Delphi is still having regular conferences and magazine articles here in Germany. Maybe we care more about enforced code quality? :)
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? Made-up theory that probably isn't worth anything without measurements: In providing an improvement over C++, including more safety and GC, D (unwillingly) positionned itself being spiritual successor in the Wirth's family of language. And Niklaus Wirth was from Switzerland so _perhaps_ the nearby territory is already more favourable to alternatives native languages. Let the speculation begin!
Re: D beyond the specs
On Friday, 16 March 2018 at 14:18:16 UTC, bauss wrote: On Friday, 16 March 2018 at 13:51:03 UTC, Chris wrote: On Friday, 16 March 2018 at 12:43:03 UTC, psychoticRabbit wrote: On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Hint: there's a Ph.D. in it ;) Hint: Do not write a Ph.D based on impressions ;-) Hint: Do not write a Ph.D. at all ;) Hint: Do not write Hint: Just don't.
[Issue 18444] [DIP25][DIP1000] Tracking issue for: "The implementation doesn't match DIPs 25/1000"
https://issues.dlang.org/show_bug.cgi?id=18444 Carsten Blüggelchanged: What|Removed |Added Depends on||18478 Referenced Issues: https://issues.dlang.org/show_bug.cgi?id=18478 [Issue 18478] Spurious "escapes a reference to local variable" error in function that does not return by reference --
[Issue 18478] Spurious "escapes a reference to local variable" error in function that does not return by reference
https://issues.dlang.org/show_bug.cgi?id=18478 Carsten Blüggelchanged: What|Removed |Added Blocks||18444 Referenced Issues: https://issues.dlang.org/show_bug.cgi?id=18444 [Issue 18444] [DIP25][DIP1000] Tracking issue for: "The implementation doesn't match DIPs 25/1000" --
Re: dmd -unittest= (same syntax as -i)
On Wednesday, 14 March 2018 at 22:04:50 UTC, Adam D. Ruppe wrote: On Wednesday, 14 March 2018 at 21:22:01 UTC, Timothee Cour wrote: would a PR for `dmd -unittest= (same syntax as -i)` be welcome? so when this came up on irc earlier (was that you?) this was the first thought that came to my mind. I'd support it, tho I'm no decision maker. I guess it was me talking about it two days ago on IRC... Almost exclusively I need to run unittests only in the module I currently work on and it really makes no sense to run other unittests at that point of time (unless I explicitly want to). I would even go further to say that we basically need to be able to run particular unittest. What I do at the moment is that I developed this kind of practice to have a test_runner.d top-level module in every D project of mine that contains tests I do during the development of particular feature TDD style, and then once I am done, I move this code to appropriate unittest blocks in my final module... There are bunch of issues with existing support for unittests that could be solved to make unit-testing a really pleasant activity.
Re: D beyond the specs
On Friday, 16 March 2018 at 13:51:03 UTC, Chris wrote: On Friday, 16 March 2018 at 12:43:03 UTC, psychoticRabbit wrote: On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Hint: there's a Ph.D. in it ;) Hint: Do not write a Ph.D based on impressions ;-) Hint: Do not write a Ph.D. at all ;) Hint: Do not write
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? I believe on is available in dtw. http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fapi%2Forg%2Feclipse%2Fswt%2Fbrowser%2FBrowser.html
Re: D beyond the specs
On Friday, 16 March 2018 at 12:43:03 UTC, psychoticRabbit wrote: On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Hint: there's a Ph.D. in it ;) Hint: Do not write a Ph.D based on impressions ;-) Hint: Do not write a Ph.D. at all ;)
Re: D beyond the specs
On Friday, 16 March 2018 at 11:44:59 UTC, Chris wrote: Hint: there's a Ph.D. in it ;) Hint: Do not write a Ph.D based on impressions ;-)
Re: Linux signal handling - notifying a condition variable
On Thursday, 15 March 2018 at 19:43:09 UTC, Patrick Schluter wrote: On Thursday, 15 March 2018 at 16:51:59 UTC, Jim King wrote: I am trying to add graceful shutdown support to a test harness. In the test harness, a server class consumes a thread to accept connections and service them. In order to stop the server, it has to be interrupted. This interruption mechanism is based on core.sync.condition. I want to add a signal handler so that if SIGINT is received, the server is interrupted and stops gracefully. signalfd [1] is a good solution on Linux. core.sys.linux.sys.signalfd; [1]: http://man7.org/linux/man-pages/man2/signalfd.2.html Thank you, this looks like the best solution. On further reading I found that it is not safe to use condition variables from signal handlers, per the documentation in https://linux.die.net/man/3/pthread_cond_signal.
[Issue 18621] core.sync.condition notify methods cannot be used from a (unix) signal handler
https://issues.dlang.org/show_bug.cgi?id=18621 James E. King IIIchanged: What|Removed |Added Status|RESOLVED|CLOSED --
[Issue 18621] core.sync.condition notify methods cannot be used from a (unix) signal handler
https://issues.dlang.org/show_bug.cgi?id=18621 James E. King IIIchanged: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from James E. King III --- Hi, on further review it seems condition variables are not safe to use from signal handlers, according to https://linux.die.net/man/3/pthread_cond_signal therefore I am closing this as invalid. --
[Issue 18621] core.sync.condition notify methods cannot be used from a (unix) signal handler
https://issues.dlang.org/show_bug.cgi?id=18621 --- Comment #1 from James E. King III--- Discussion on the forum, for reference: https://forum.dlang.org/thread/xakcezblunbflwxby...@forum.dlang.org --
[Issue 18621] New: core.sync.condition notify methods cannot be used from a (unix) signal handler
https://issues.dlang.org/show_bug.cgi?id=18621 Issue ID: 18621 Summary: core.sync.condition notify methods cannot be used from a (unix) signal handler Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: jk...@apache.org Using core.stdc.signal I can set up a signal handler to handle SIGINT (^C), however signal handlers have a limited set of things they can do. The handler must be nothrow and @nogc. pthread_cond_signal and pthread_cond_broadcast are safe to call in a signal handler and typically used to trigger shutdowns, however core.sync.condition has no safe method that can be called to notify or notifyAll. Would it be possible to add a "nothrow @nogc" safe version of these methods that return an error code instead of throw so that core.sync.condition can be used in a (unix) signal handler? Thanks. --
Re: Allocator Part of Type
On Friday, 16 March 2018 at 06:20:42 UTC, Eugene Wissner wrote: [snip] That's interesting thanks.
D beyond the specs
Would it be possible to find out at DConf in Munich why exactly D is so popular in Germany (my impression) and in other countries of Europe (and that general post code) like France, Italy, GB, Romania and Russia etc.? I've always been intrigued by the fact that it originated in the US but that it's in "the old world" that a lot of enthusiasts (and contributors) are found. It's just because you would usually associate innovation with the "new world", but in this particular case D must have struck a chord with the old world. Is it marketing and economic / pragmatic factors that lead to poor adoption rates (and sometimes outright hostility) in the US. Maybe, but I think there's something in the engineering approach and the concepts that "talks" to us in the "old world". I think this is an interesting topic as regards both culture and technology. Any technology is embedded in and the product of a certain culture / way of thinking - and D seems to be a special case. Hint: there's a Ph.D. in it ;)
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 11:04:31 UTC, Jayam wrote: On Friday, 16 March 2018 at 10:53:39 UTC, bauss wrote: On Friday, 16 March 2018 at 10:52:14 UTC, Alex wrote: On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? Do you mean something like this? http://vibed.org/api/diet.dom/ I think he means something like an embedded web browser component. Yes, I need component like Web Browser of windows form. I don't think there is any written in D, but you could probably bind against webkit or gecko.
Re: DConf 2018 - The touristy bits
On Thursday, 15 March 2018 at 20:01:07 UTC, Walter Bright wrote: On 3/15/2018 4:33 AM, Chris wrote: For sight-seeing, I'd recommend the CityTourCard: https://www.mvv-muenchen.de/en/tickets-and-fares/tickets-daytickets/citytourcard/index.html#c12632 Does the "entire network" price include the airport? According to this map, yes (it's huge): https://www.mvv-muenchen.de/fileadmin/mediapool/03-Plaene_Bahnhoefe/Tarifplaene/TARIFPLAN_Gesamtnetz_2018.PDF The airport is roughly at 1 o'clock. Here's the inner network "Innenraum" (the airport is not on it): https://www.mvv-muenchen.de/fileadmin/mediapool/03-Plaene_Bahnhoefe/Tarifplaene/TARIFPLAN_Innenraum_2018.PDF
Re: DConf 2018 - The touristy bits
On Friday, 16 March 2018 at 11:12:06 UTC, Chris wrote: On Thursday, 15 March 2018 at 20:01:07 UTC, Walter Bright wrote: On 3/15/2018 4:33 AM, Chris wrote: For sight-seeing, I'd recommend the CityTourCard: https://www.mvv-muenchen.de/en/tickets-and-fares/tickets-daytickets/citytourcard/index.html#c12632 Does the "entire network" price include the airport? According to this map, yes (it's huge): https://www.mvv-muenchen.de/fileadmin/mediapool/03-Plaene_Bahnhoefe/Tarifplaene/TARIFPLAN_Gesamtnetz_2018.PDF The airport is roughly at 1 o'clock. Here's the inner network "Innenraum" (the airport is not on it): https://www.mvv-muenchen.de/fileadmin/mediapool/03-Plaene_Bahnhoefe/Tarifplaene/TARIFPLAN_Innenraum_2018.PDF goto "Tariff Maps": https://www.mvv-muenchen.de/en/maps-stations/maps/index.html "Network Maps" will give you the available services (S-Bahn, U-Bahn, buses etc.)
[Issue 18620] `error cannot be interpreted at compile time` is missing context where error occurs
https://issues.dlang.org/show_bug.cgi?id=18620 RazvanNchanged: What|Removed |Added CC||razvan.nitu1...@gmail.com Assignee|nob...@puremagic.com|razvan.nitu1...@gmail.com --
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 10:53:39 UTC, bauss wrote: On Friday, 16 March 2018 at 10:52:14 UTC, Alex wrote: On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? Do you mean something like this? http://vibed.org/api/diet.dom/ I think he means something like an embedded web browser component. Yes, I need component like Web Browser of windows form.
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? Do you mean something like this? http://vibed.org/api/diet.dom/
Re: Is there any web browser control in D Lang to display html file ?
On Friday, 16 March 2018 at 10:52:14 UTC, Alex wrote: On Friday, 16 March 2018 at 10:31:51 UTC, Jayam wrote: I creating one simple desktop application using dlang. I need to display some html file in my desktop application. How can make it works ? Do you mean something like this? http://vibed.org/api/diet.dom/ I think he means something like an embedded web browser component.