[Issue 18831] Weird interaction between std.variant, std.algorithm.iteration.map, and alias this
https://issues.dlang.org/show_bug.cgi?id=18831 --- Comment #1 from |--- Some notes on paring it down: * Omitting the call to map makes this compile. * Omitting the alias this makes it compile. * You don't actually need a struct Bar; `map!(x => x)` is enough. * You can use an array instead of iota. * Replacing the lambda parameter with a top-level function (map!identity) changes the error to: /home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7784): Error: function algebraicaliasthis.identity(string s) is not callable using argument types () /home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template instance `std.typecons.ReplaceType!(This, VariantN!(1LU, Foo), Foo).F!(identity)` error instantiating /home/dhasenan/.local/bin/../include/phobos/std/meta.d(805): instantiated from here: staticMap!(replaceTemplateArgs, identity) /home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788): instantiated from here: staticMap!(replaceTemplateArgs, identity, string[]) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(103): instantiated from here: ReplaceType!(This, VariantN!(1LU, Foo), Foo) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(137): instantiated from here: This2Variant!(VariantN!(1LU, Foo), Foo) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(1500): instantiated from here: VariantN!(1LU, Foo) algebraicaliasthis.d(16):instantiated from here: Algebraic!(Foo) --
D4M In D?
http://www.mit.edu/~kepner/D4M/ Anyone?
[Issue 18831] New: Weird interaction between std.variant, std.algorithm.iteration.map, and alias this
https://issues.dlang.org/show_bug.cgi?id=18831 Issue ID: 18831 Summary: Weird interaction between std.variant, std.algorithm.iteration.map, and alias this Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nob...@puremagic.com Reporter: dhase...@gmail.com --- import std.variant, std.range, std.algorithm; struct Bar { int i; } struct Foo { auto i() { return iota(12) .map!(x => Bar(x)); } alias i this; } void main() { Foo controlGroup = Foo(); Algebraic!(Foo) treatmentGroup = Foo(); } --- The control group works without errors. The treatment group fails with: /home/dhasenan/.local/bin/../include/phobos/std/meta.d(799): Error: template instance `F!(__lambda1)` cannot use local __lambda1 as parameter to non-global template replaceTemplateArgs(T...) /home/dhasenan/.local/bin/../include/phobos/std/meta.d(805): Error: template instance `algebraicaliasthis.Foo.i.staticMap!(replaceTemplateArgs, __lambda1)` error instantiating /home/dhasenan/.local/bin/../include/phobos/std/typecons.d(7788): instantiated from here: staticMap!(replaceTemplateArgs, __lambda1, Result) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(103): instantiated from here: ReplaceType!(This, VariantN!(1LU, Foo), Foo) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(137): instantiated from here: This2Variant!(VariantN!(1LU, Foo), Foo) /home/dhasenan/.local/bin/../include/phobos/std/variant.d(1500): instantiated from here: VariantN!(1LU, Foo) algebraicaliasthis.d(20):instantiated from here: Algebraic!(Foo) --
Re: could someone test support for Asian languages in nanogui port?
On Friday, 4 May 2018 at 10:40:52 UTC, drug wrote: I port nanogui, but besides porting I'd like to improve it using great capabilities of D language provides. One of them is utf support, so I added support for Asian languages to nanogui.TextBox. But I'm not sure I've did it well and so I'd like to ask someone to test it using the following: ``` git clone --recursive https://github.com/drug007/nanogui.git cd nanogui git checkout textbox # TextBox exists in this branch only dub --config=sdl # Keyboard events provided only by SDL2 backend only ``` On the right side there will be a window with four text boxes with russian, english, japanese and chinese text respectively. It would be nice to get some feedback from users - probably I did something totally wrong. Also I'm curious does it worth efforts? hi, I'm a Chinese, and I just have done the test. I also copied some Japanese text from Dlang twitter channel and added some Chinese wide punctuation Char. And It's all seems displayed correctly. The resulting screenshot is here: https://pasteboard.co/HjRmOYg.png The only problem is that the font style simply looks strange. You can see the 'normal' text display in Win10 by default like this: https://pasteboard.co/HjRrigh.png And the font problem is probably related to SDL or GL, for all UI based on GL or SDL, they all have the same problem. Dlangui also has the same situation, that's why I just did not use Dlangui for a production project. But, Anyway, the text is displayed correctly. Great work for doing this! Dlang needs a great GUI framework.
Re: D as a college language
On Saturday, 5 May 2018 at 15:13:34 UTC, Russel Winder wrote: In that C is a portable assembly language and Java is an object-based language supporting some forms of polymorphism they are very different, but they are far from extremes. Come on, the difference between C and Java is far more than that. The differences are so extreme actually, that undergrads deserve to be introduced to both. Introducing python to undegrads is an abomination! Introducing D to undergrads is problematic, since D is an unprincpled mix of pretty much everything - and more to come (which is good in some sense, and bad in another sense). D is the swiss army knife of programming langauges. What is great about D, is how it integrates it all into one tool, making it easier to use those tools. But IMO, D is not ideal for undergrads, as it's a little too unprincipled - and undergrads needs principled approaches when starting off. In addition, the syntax of C and Java is not too different, so undergrads can switch from one to other other without too much drama. Imagine switching between C and Go, or Java and Go, or Java and Python etc..etc. C and Java provide the greatest learning experience for undergrads, IMO, and at the least 'cognitive' cost. Python should be banned! Cut of it's head!! Hopefully this is a troll, and you don't mean that. No. I do mean it. Python has no place in an undergrad course. As someone intimately involved with a university for many, many years, I have to wonder whether teachers are the problem, rather than the solution ;-) I can't speak with direct evidence for the last decade but certainly till then far too many academics in the UK couldn't really program well at all. The whole university system militates against programming as something an academic is good at. Fortunately there seem to be just enough academics who can program well, at least in the top universities, that the programming courses do actually get taught well. Of course with programming moving from university to school (6 to 18) the problem shifts from academics to school teachers. The thing is, those teaching in uni are not really 'teachers'. They are usually just filling in time, to earn some extra money or whatever, while continuing their studies or research. Very few actually know how to 'teach', and even few are motivate to 'teach'. Undergrads can learn a great deal more from just buying some good books (or even a single good book). Perhaps this is why programming should be 'taught' before students reach uni, and then they can focus on doing more productive things when they get to uni, rather than learning how to write a for loop, or move circle around the screen!
[Issue 5034] Ranged (or bounded) array initializer
https://issues.dlang.org/show_bug.cgi?id=5034 greenifychanged: What|Removed |Added CC||greeen...@gmail.com --- Comment #3 from greenify --- We will have staticArray in Phobos soon which will greatly help in doing this purely as a library. Though this obviously could already been done easily as a library today. This is definitely very unlikely to end up in the language. --
[Issue 13507] std.range.enumerate with BigInt indexes too
https://issues.dlang.org/show_bug.cgi?id=13507 --- Comment #1 from Seb--- PR in progress: https://github.com/dlang/phobos/pull/6496 --
Re: D as a college language
On Friday, 4 May 2018 at 11:35:22 UTC, Sjoerd Nijboer wrote: So i'm a college student in and what bothers me is that there seem to kind of assume programming languages don't evolve or don't get replaced by better ones. Right now if you go to college you'll most likely get tought c++, c# or java for any comp sci degree. While these languages are industrial standards, they all have their drawbacks. And one drawback that looks important for teaching is flexibility in expressiveness. [...] @ everyone in this discussion: you ask and answer the wrong question. The question needs to be: "What can we do or improve upon to allow D playing a bigger role in education?"
Re: D as a college language
On Friday, 4 May 2018 at 11:35:22 UTC, Sjoerd Nijboer wrote: So i'm a college student in and what bothers me is that there seem to kind of assume programming languages don't evolve or don't get replaced by better ones. Right now if you go to college you'll most likely get tought c++, c# or java for any comp sci degree. While these languages are industrial standards, they all have their drawbacks. And one drawback that looks important for teaching is flexibility in expressiveness. From my experience college students seem to have problems translating their often declarative thought process into actual semi compile-able code that runs in a given language. Since D seems to be a language that supports a lot of programming paradigms very well, wouldn't it be beneficial to learn people declarative programming using D for a little and from there expose them to other programming styles in thesame language to lower the barrier of entry? I think D could play a bigger role in education since its such a "clean" language that is flexible but doesn't have any real gotcha "features". Its also a language that could potentially be used over someones entire college career as the primary language. If this would be achieved there would be a higher income flow into the industry of young D programmers which will pollute other programmers with the D mind and featureset. I thought it might help if I mentioned that I successfully used D as one of three languages to teach the Programming Languages course at Vassar College last Fall. The main reason I ended up using three languages was this: 1. Most undergraduate CS courses that I sampled (at UW, for one taught by Dan Grossman, among others) use a core functional programming language such as (S)ML which really helps in solidifying some of the principles of programming languages—the concept of environment, scope, binding; functions as values; curry, filter, map, etc. Plus it has a version that comes with a REPL and really helps students explore it. That said, it is not a "industrial strength" language, and since I also wanted to empasize on the pragmatic aspects, it could not be the only one. 2. I briefly introduced the concept of logic programming using Prolog, but I couldn't really spend too much time on it and so cannot count it as another language 3. When I asked students what language they would like to choose—given the choice, most of the class leaned towards Python. That plus the likelihood of them actually using it at some point, I decided to cover some programming language aspects using it over two-three weeks. It also has some fascinating feature sets (dunder methods, some meta programming niceties, etc.) and being interpreted language, provides a nice complementary view. 4. The rest of the course used D. I used both Andrei Alexandrescu's book and Ali's book to generate the course content. I was fortunate to have a stack of slides from the Andrei himself. And even more fortunate, as it happened to spend a Boston D meetup dinner with the two and Steven Schv-guy. I have been in love with D ever since I firsr started reading Andrei's book in 2010, and it was really quite something that I could use it in an undergraduate CS curriculum seven years later. Originally, I was hoping to use D for the entire course, but then given various aspects of the course, and the styles in which it is being taught many places made me change things a bit. Oh, and I should mention that I did get a few slides from Chuck Allison who uses D to teach a small part of his course at UVU. If you haven't seen his talk at, I believe the first/second DConf at UVU, I would highly recommend it. The icing on the cake was that Andrei was able to visit Vassar in November and give a talk on his Fastware muse (if I may call it that). He was an instant success! I am scheduled to teach the course again next Spring, and I am trying to figure out how/if I can use more D than I did the last time without sacrificing some of the goodness that (S)ML brings to the table. That way I can cover more programming paradigms that D brings to life—built in unittests, contract programming, delegates, and many many more—with a flair. Any thoughts/pointers that this wonderful community can provide would be very much appreciated. -- Sameer
[Issue 18830] Document Allowance for "new" with "scope" in @nogc Functions
https://issues.dlang.org/show_bug.cgi?id=18830 greenifychanged: What|Removed |Added CC||greeen...@gmail.com --- Comment #1 from greenify --- FWIW scope & new will result in an allocation on the stack, though I agree that this should be properly documented. --
Re: Funding for code-d/serve-d
On Saturday, 5 May 2018 at 23:29:52 UTC, Rubn wrote: Any roadmap for what improvements will be made? It seems like it might have been a better choice to support dcd/dscanner/dfix. Most of the functionality is provided by those utilities for pretty much every IDE toolset out there, including code-d/serve-d. We'll work out the details with Webfreak. DCD and friends will surely get a goal at some point.
[Issue 15437] documentation for typeof(someTemplate) == void
https://issues.dlang.org/show_bug.cgi?id=15437 --- Comment #8 from Johannes Loher--- Realated comment in the corresponding section in dmd: /* Today, 'typeof(func)' returns void if func is a * function template (TemplateExp), or * template lambda (FuncExp). * It's actually used in Phobos as an idiom, to branch code for * template functions. */ Does anybody know where this is actually used in phobos? Wouldn't it be better to use isTemplate in this case? --
Re: Funding for code-d/serve-d
On Saturday, 5 May 2018 at 11:21:29 UTC, Mike Parker wrote: This morning at the Hackathon I announced that the D Foundation is raising money for code-d/serve-d, the plugin for Visual Studio Code and its companion Microsoft Language Server Protocol implementation for D. We've set up a goal of $3000 at our Open Collective page: https://opencollective.com/dlang# At the top of the page, you'll see our current balance, the projected balance at the end of the year based on the current level of monthly donations, and the goal of $3000 on the far right. We're sitting at just over $1100 as I write this, which means we're almost halfway there already. We encourage those of you who use Webfreak's VS Code plugin to contribute whatever you can in order to fund its development, especially if you want to see it improve. An important point is that development on serve-d can ultimately benefit not just code-d, but other IDE and editor plugins where it may be used. If we reach $2700 within 30 days, the D Foundation will throw in the remaining $300 and we'll let Webfreak get to work. If this proves successful, we hope to use future goals to fund development across the D ecosystem. Some of our targets will be driven by the results of the recent State of D Survey and others will be driven by other concerns. If you are interested in helping to move the state of D development forward, please consider contributing! Any roadmap for what improvements will be made? It seems like it might have been a better choice to support dcd/dscanner/dfix. Most of the functionality is provided by those utilities for pretty much every IDE toolset out there, including code-d/serve-d.
[Issue 15437] documentation for typeof(someTemplate) == void
https://issues.dlang.org/show_bug.cgi?id=15437 Andrei Alexandrescuchanged: What|Removed |Added Keywords||preapproved --- Comment #7 from Andrei Alexandrescu --- preapproved --
Re: Diamond mentioned in stackshare.io article
On 05/05/2018 04:45 PM, Gheorghe Gabriel wrote: On Saturday, 5 May 2018 at 20:34:05 UTC, Gheorghe Gabriel wrote: [...] Sorry for my english mistakes. I am very tired right now and english is not my main language. I cannot correct that 2 it's -> to -> its. No worries, even most native English speakers get it's/its mixed up.
[Issue 7947] typeof on anonymous function literal returns void
https://issues.dlang.org/show_bug.cgi?id=7947 Johannes Loherchanged: What|Removed |Added CC||johannes.lo...@fg4f.de --- Comment #4 from Johannes Loher --- Related: https://issues.dlang.org/show_bug.cgi?id=15437 I briefly talked to both Andrei and Walter today at dconf about this. They both agreed, that calling typeof on a template should be an error (similiar to how calling typeof on a type is an error). Any thoughts on that? --
[Issue 15437] documentation for typeof(someTemplate) == void
https://issues.dlang.org/show_bug.cgi?id=15437 Johannes Loherchanged: What|Removed |Added CC||johannes.lo...@fg4f.de --- Comment #6 from Johannes Loher --- Related: https://issues.dlang.org/show_bug.cgi?id=7947 I briefly talked to both Andrei and Walter today at dconf about this. They both agreed, that calling typeof on a template should be an error (similiar to how calling typeof on a type is an error). Any thoughts on that? --
[Issue 10919] typeof should accept types
https://issues.dlang.org/show_bug.cgi?id=10919 Johannes Loherchanged: What|Removed |Added CC||johannes.lo...@fg4f.de --- Comment #4 from Johannes Loher --- It has been a long time since this has seen any attention, but I also agree with Timon. How should we go forward with this one? I highly doubt, it will ever be implemented and if so, it might need a DIP? --
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 20:34:05 UTC, Gheorghe Gabriel wrote: [...] Sorry for my english mistakes. I am very tired right now and english is not my main language. I cannot correct that 2 it's -> to -> its.
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 18:56:52 UTC, Gheorghe Gabriel wrote: On Saturday, 5 May 2018 at 14:06:45 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:32:38 UTC, Gheorghe Gabriel wrote: On Saturday, 5 May 2018 at 12:17:48 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:14:38 UTC, bachmeier wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: [...] Absolutely. This, not [technical feature X], is what will lead to adoption of D. Agreed! D can have all these nice features, but what matters in enterprise development is what frameworks D had that can be used in productivity and not just for projects you code at home. That was the sole reason I did Diamond too. I focused on having it fit for enterprise development since the beginning. I love Diamond! It is my favorite framework written in D so far. I've been working on a big project in D for three weeks, after one year of D experience. Can't wait to finally expose it. Thank you so much! When you get started with it, don't hesitate to ask me about stuff! Thank you! I need a little help (maybe an example) on dll reflection. I can't figure it out how to do it. I need to instantiate new "Unknown" objects from dll, without closing the app and recompiling it. I think it's a very big step for D to have a Studio Software. My idea is to create an editor for D app development. Wanted features: 1) Main templates: - GUI Application with a 2D/3D scene (this is where I need dll reflection) - Web Application using Diamond (with a powerful GUI Editor) 2) Targets: - Windows, Linux, MacOS - Android, iOS*, WinStore* - HTML5 using WebAssembly - Vulkan and OpenGLES - Maybe multithreaded safe Some current features: - Awsome Event Listener for GUI. I am sure you will love it. - A 3D scene with a camera movement (mouse + WASD keys) - Node based scene (unique id per node) - Class managers for Input, Core, Graphics, Audio - Very productive (It has a lot of static if, static foreach, mixin, UDA, __traits ..) - Just D cool stuff. - It uses OpenGL as it's main graphics library and SDL2 for window, keyboard.. - It is very fast because of its architecture, very optimized Some good statistics: Simple 3D scene with some objects, compiled with DMD on Win64 release mode (i7-6700k, 24gb ram + GTX960m = 600 fps 1080p) I have a lot ideas for it but the exam session will finish after two months, so, unfortunately, I won't be able to work on it until then. After this, I am going to take 4 hours per day to work on it. My dream is to have the chance to present it at DConf 2020. :) ... And by the way, I will implement it's website in Diamond MVC.
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 14:06:45 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:32:38 UTC, Gheorghe Gabriel wrote: On Saturday, 5 May 2018 at 12:17:48 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:14:38 UTC, bachmeier wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: [...] Absolutely. This, not [technical feature X], is what will lead to adoption of D. Agreed! D can have all these nice features, but what matters in enterprise development is what frameworks D had that can be used in productivity and not just for projects you code at home. That was the sole reason I did Diamond too. I focused on having it fit for enterprise development since the beginning. I love Diamond! It is my favorite framework written in D so far. I've been working on a big project in D for three weeks, after one year of D experience. Can't wait to finally expose it. Thank you so much! When you get started with it, don't hesitate to ask me about stuff! Thank you! I need a little help (maybe an example) on dll reflection. I can't figure it out how to do it. I need to instantiate new "Unknown" objects from dll, without closing the app and recompiling it.
[Issue 6318] module isn't fully processed under weird conditions
https://issues.dlang.org/show_bug.cgi?id=6318 Basile B.changed: What|Removed |Added CC||b2.t...@gmx.com Resolution|FIXED |WORKSFORME --- Comment #5 from Basile B. --- Please use WORKSFORME as resolution when you see it works now but don't know exactly why or which PR solved the issue. --
Re: D for microservices
On 10/23/2017 06:02 PM, Adam Wilson wrote: On 10/23/17 05:08, Jacob Carlborg wrote: * Database drivers for the common databases (PostgreSQL, MySQL, SQLite) compatible with vibe.d * Database driver abstraction on top of the above drivers, perhaps some lightweight ORM library I've been looking pretty extensively at these two items recently. If the database drivers are compatible with Vibe.d AND we wish to provide a common abstraction layer for them (presumably via Phobos) then order for the abstraction layer to aware of the whether the driver is making a blocking or non-blocking call we must include Vibe.D in the abstraction layer. Mysql-native is vibe.d-compatible, but also works when you have zero vibe.d dependencies (in which case it switches to Phobos's sockets instead of using Vibe's sockets.)
Re: D for microservices
On 05/05/2018 02:30 PM, Nick Sabalausky (Abscissa) wrote: On 10/23/2017 06:02 PM, Adam Wilson wrote: On 10/23/17 05:08, Jacob Carlborg wrote: * Database drivers for the common databases (PostgreSQL, MySQL, SQLite) compatible with vibe.d * Database driver abstraction on top of the above drivers, perhaps some lightweight ORM library I've been looking pretty extensively at these two items recently. If the database drivers are compatible with Vibe.d AND we wish to provide a common abstraction layer for them (presumably via Phobos) then order for the abstraction layer to aware of the whether the driver is making a blocking or non-blocking call we must include Vibe.D in the abstraction layer. Mysql-native is vibe.d-compatible, but also works when you have zero vibe.d dependencies (in which case it switches to Phobos's sockets instead of using Vibe's sockets.) Sorry, didn't notice this was a half-year-old thread.
Re: Error: module `hello` is in file 'hello.d' which cannot be read
On Saturday, 5 May 2018 at 17:13:08 UTC, IntegratedDimensions wrote: You need to make sure hello.d is in the current dir dir C:\D does hello.d show up? If not, then dmd can't find it and you have to tell it where it is or be in the right location. type dmd ThereIsNowFileHere12342123242231231412.d and you will get the same error message. You have to be right. I removed the directory and started making de hello world file again and now it works. Thank you to everyone? Alex
Re: Error: cannot deduce function from argument types
On Saturday, 5 May 2018 at 17:06:13 UTC, Neia Neutuladh wrote: On Saturday, 5 May 2018 at 16:42:12 UTC, Sisor wrote: Error: template std.string.stripRight cannot deduce function from argument types You used http://dpldocs.info/experimental-docs/std.string.stripRight.html This function only takes one argument and strips whitespace. You want http://dpldocs.info/experimental-docs/std.algorithm.mutation.stripRight.1.html This function can take two arguments and strips the second from the first. https://dlang.org/phobos/std_string.html#.stripRight has an overload with a second argument. The std.algorithm.mutation version does only work with my second solution, which solves the problem. So thanks! But I still don't understand the problem.
Re: Error: module `hello` is in file 'hello.d' which cannot be read
On Saturday, 5 May 2018 at 12:26:20 UTC, Bauss wrote: Try to add module hello; To the top of the file Still not working. I tryed both module hello; and module 'hello'; C:\D\dmd2\sources>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import C:\D\dmd2\sources>
Re: Error: module `hello` is in file 'hello.d' which cannot be read
On Friday, 4 May 2018 at 23:29:12 UTC, Alex wrote: Hi I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical import std.stdio; void main() { writeln("Hello, World!"); } And I try to compile and get C:\D>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import What do I do wrong ? D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources. Thank you to you Alex You need to make sure hello.d is in the current dir dir C:\D does hello.d show up? If not, then dmd can't find it and you have to tell it where it is or be in the right location. type dmd ThereIsNowFileHere12342123242231231412.d and you will get the same error message.
Re: Error: cannot deduce function from argument types
On Saturday, 5 May 2018 at 16:42:12 UTC, Sisor wrote: Error: template std.string.stripRight cannot deduce function from argument types You used http://dpldocs.info/experimental-docs/std.string.stripRight.html This function only takes one argument and strips whitespace. You want http://dpldocs.info/experimental-docs/std.algorithm.mutation.stripRight.1.html This function can take two arguments and strips the second from the first.
[Issue 18623] Documented unittest should not allow private symbol access
https://issues.dlang.org/show_bug.cgi?id=18623 --- Comment #3 from Nick Treleaven--- (In reply to Steven Schveighoffer from comment #2) > You may want to test things inside > your unit test that have nothing to do with the example, but use the same > code for setup, and then you have to write that code twice. If you really want your *documented* unittest not to be runnable by a user, you can wrap your private code in a free function with `protected` access as a workaround. > It's pretty easy to say // private data, for testing only. The whole point of this issue is for when the programmer is unaware that the documented example contains private symbols *unintentionally*. This is clearly a significant problem otherwise @greenify wouldn't have added a custom automated test for Phobos to check this. Copying and pasting from other tests is a classic trigger for this. --
Error: cannot deduce function from argument types
Hi, I have a function: string strippedString(ubyte[] block) { return (cast(string)block).stripRight("\0"); } With dmd it compiles, with ldc it produces the following error message: Error: template std.string.stripRight cannot deduce function from argument types !()(string, string), candidates are: /usr/lib/ldc/x86_64-linux-gnu/include/d/std/string.d(2902,6): std.string.stripRight(Range)(Range str) if (isSomeString!Range || isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && !isConvertibleToString!Range && isSomeChar!(ElementEncodingType!Range)) /usr/lib/ldc/x86_64-linux-gnu/include/d/std/string.d(3015,6): std.string.stripRight(Range)(auto ref Range str) if (isConvertibleToString!Range) ldmd2 failed with exit code 1. Why? The modified function does not even compile with either compiler: string strippedString(ubyte[] block) { return cast(string)( block.stripRight(0) ); } How can I make the function more specific, so that the compiler knows, which option to take? Kind regards, Sisor
Re: Should 'in' Imply 'ref' as Well for Value Types?
On Saturday, 5 May 2018 at 15:22:04 UTC, Bolpat wrote: I once proposed that `in` can mean `const scope ref` that also binds rvalues. https://github.com/dlang/DIPs/pull/111#issuecomment-381911140 We could make `in` be something similar to `inline`. The compiler can implement it as stated above (assign the expression to temporary, reference it), or use copy if copy is cheaper than referencing. I remember, and I still like that proposal a lot, as it'd allow the compiler to tune generic code to the targeted platform and its ABI and free the dev from having to worry about how to pass a read-only input argument in the most efficient way. So if `in` semantics are ever to be redefined, `const [scope ref]` (depending on type and target ABI) are the only ones I'd happily agree with. [And I'd be extremely happy if rvalues could finally bind to ref params, not just as prerequisite for this.]
Re: unit-threaded v0.7.45 - now with more fluency
On Saturday, 5 May 2018 at 13:28:41 UTC, Atila Neves wrote: For those not in the know, unit-threaded is an advanced testing library for D that runs tests in threads by default. It has a lot of features: http://code.dlang.org/packages/unit-threaded New: * Bug fixes * Better integration testing * unitThreadedLight mode also runs tests in threads * More DDoc documentation (peer pressure from Adam's site) * Sorta kinda fluent-like asserts On the new asserts (should and should.be are interchangeable): 1.should == 1 1.should.not == 2 1.should.be in [1, 2, 3] 4.should.not.be in [1, 2, 3] More controversially (due to a lack of available operators to overload): // same as .shouldApproxEqual 1.0.should ~ 1.0001; 1.0.should.not ~ 2.0; // same as .shouldBeSameSetAs [1, 2, 3].should ~ [3, 2, 1]; [1, 2, 3].should.not ~ [1, 2, 2]; I also considered adding `.should ~=`. I think it even reads better, but apparently some people don't. Let me know? The operator overloads are completely optional. Atila Personally, I don't like that kind of "abuse" of operators at all. I think it looks really unusual and it kind of breaks your "flow" when reading the code. Additionally, people, who don't know about the special behaviour the operators have in this case, might get really confused. I would much prefer it, if you used a more common fluent style (like 1.0.should.be.approximately(1.0001);). Anyways, thanks for working on this awesome project!
[Issue 7184] parse error on *(x)++
https://issues.dlang.org/show_bug.cgi?id=7184 Sebchanged: What|Removed |Added CC||greensunn...@gmail.com --- Comment #11 from Seb --- PR https://github.com/dlang/dmd/pull/8218 --
Re: Should 'in' Imply 'ref' as Well for Value Types?
On Saturday, May 05, 2018 15:22:04 Bolpat via Digitalmars-d wrote: > On Friday, 4 May 2018 at 09:34:14 UTC, Jonathan M Davis wrote: > > [...] > > It's actually not infrequent now that in C++, you want to pass > > stuf by value rather than const& precisely because move > > semantics can be used to avoid copies. So, it's not at all > > necessarily the case that passing by ref is the efficient thing > > to do. It's heavily dependent on the code in question. > > I once proposed that `in` can mean `const scope ref` that also > binds rvalues. > https://github.com/dlang/DIPs/pull/111#issuecomment-381911140 > We could make `in` be something similar to `inline`. The compiler > can implement it as stated above (assign the expression to > temporary, reference it), or use copy if copy is cheaper than > referencing. Having ref of any kind accept rvalues is a highly controversial issue, and it may or may not ever be in the language. If it's added, then at that point, whether it makes sense to make in imply ref could be re-examined, and maybe at that point, doing so would make great sense. But as long as ref does not accept rvalues, it really doesn't make sense. It would break too much code and would be far too annoying to use in many, many cases where it is currently commonly used. - Jonathan M Davis
Re: Should 'in' Imply 'ref' as Well for Value Types?
On Friday, 4 May 2018 at 09:34:14 UTC, Jonathan M Davis wrote: [...] It's actually not infrequent now that in C++, you want to pass stuf by value rather than const& precisely because move semantics can be used to avoid copies. So, it's not at all necessarily the case that passing by ref is the efficient thing to do. It's heavily dependent on the code in question. I once proposed that `in` can mean `const scope ref` that also binds rvalues. https://github.com/dlang/DIPs/pull/111#issuecomment-381911140 We could make `in` be something similar to `inline`. The compiler can implement it as stated above (assign the expression to temporary, reference it), or use copy if copy is cheaper than referencing. So, even if we were designing in from scratch, making ref would be a questionable choice. However, even if we all agreed that it would be desirable, such a change would break a large percentage of code that currently uses in, because any code that passes an rvalue to a function taking its argument as in would then break. So, any attempt to change in to include ref would have to have some sort of deprecation path to avoid code breakage. But given how annoying it would be to have in be ref by default due to how that affects rvalues, I'm willing to bet that most programmers would not be at all happy with such a change, regardless of how well the transitition was handled. Yes. Therefore the idea above. It will break much less code if any.
Re: D as a college language
On Sat, 2018-05-05 at 11:57 +, KingJoffrey via Digitalmars-d wrote: > On Saturday, 5 May 2018 at 11:25:45 UTC, Russel Winder wrote: > > […] > > What is the pedegogy here, what are the justifications. > > That the languages being taught to undergrads, must be pervasive. Not needed. The language must be good and fit for purpose not necessarily pervasive. For example Clean is an excellent language for teaching functional programming. That most professional programmers have ever heard of it doesn't undermine it's suitability. Conversely, Spark Ada is pervasive but would you use it to teach programming? However, I think it is right that exiting undergraduates have experience of Python, Java, and other languages used in the world of work, but they do not necessarily have to be the teaching languages. > That the languages being taught to undergrads, must teach them > about low-level types, and higher-level types. Definitely. Abstraction is at the core of programming. But different programming language have different type systems. So Ceylon, Haskell, OCaml, and Lisp are language for learning this sort of stuff. > And a whole lot of other stuff..(e.g, open source, cross > platform, have multiple compilers, standardised, formalised, > etc..) ..I can't be bothered typing any more ... Clearly the technology of programming in a professional way is important. But this is not specific to the programming language. And if we add IDE support as an integral part of professional programming, D fails to meet the criteria. > > In UK we have Scratch then Python then ??? This is working > > tremendously well to get large numbers of young people > > programming far better than most professional programmers. > > > > Don't teach undergrads how to play with toys! > > They can play with toys in junior high school, sure. Do not underestimate the quality and quantity of code written by 14 year olds with a Scratch and Python background. They put a large swathe of professional programmers to shame. And this with school teachers who are not at all sure they know what they are doing. CAS, Code Club, and other organisations have helped massively. More importantly though in a situation where new undergraduates already know Python, universities have to have a whole new approach. This is a revolution to traditional university CS education and training. Most universities in the UK are having to completely rework the whole curriculum ad way of working. For the better. […] > > C and Java are not extremes. Lisp, assembly language, Haskell, > > Erlang, these are extremes. > > C and Java, in comparison to each other, are at the end of each > extreme. In that C is a portable assembly language and Java is an object-based language supporting some forms of polymorphism they are very different, but they are far from extremes. > Those other languages you mention are mostly irrelevant (at least > on a grand scale), and certainly non-pervasisve. They have no > place in undergrad course. Erlang still runs much of the international telephone system, and a lot of share trading systems. Haskell is used for a lot of quant work in finance houses. Common Lisp and Clojure between them run quite a lot of Web systems and a lot of front-end share trading systems. They are very relevant and any undergraduate who has used them at all is probably sub-standard. > > > > D could be a postgrad interest perhaps. > > > > No, this would be a bad idea.We can debate this elsewhere. > > That should depend on the interests of the postgrad. > > At some point, we really, really should let them choose to focus > on what interests them. That is what options and projects are for. It all works very well in the UK. […] > you forgot 'mobile'. I guess a lot of people are interested in mobile, which these days means Swift and Kotlin. […] > > Python should be banned! Cut of it's head!! Hopefully this is a troll, and you don't mean that. Python is used by a huge swathe of data science and especially the quants who more or less run the finance system of the world. […] > > As someone intimately involved with a university for many, many > years, I have to wonder whether teachers are the problem, rather > than the solution ;-) I can't speak with direct evidence for the last decade but certainly till then far too many academics in the UK couldn't really program well at all. The whole university system militates against programming as something an academic is good at. Fortunately there seem to be just enough academics who can program well, at least in the top universities, that the programming courses do actually get taught well. Of course with programming moving from university to school (6 to 18) the problem shifts from academics to school teachers. -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc
[Issue 6393] allow undefined aliases as template parameters and alias tuples
https://issues.dlang.org/show_bug.cgi?id=6393 Johannes Loherchanged: What|Removed |Added Status|NEW |RESOLVED CC||johannes.lo...@fg4f.de Resolution|--- |WONTFIX --- Comment #2 from Johannes Loher --- This would definitely need a DIP. I am in high doubt this will ever happen and it has not seen any attention since 2011, so I am closing this for now. If you are really interested in making this feature happen, please consider writing a DIP for it. --
[Issue 18830] New: Document Allowance for "new" with "scope" in @nogc Functions
https://issues.dlang.org/show_bug.cgi?id=18830 Issue ID: 18830 Summary: Document Allowance for "new" with "scope" in @nogc Functions Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: minor Priority: P1 Component: dlang.org Assignee: nob...@puremagic.com Reporter: mad...@gmail.com For the description for @nogc functions as found here: https://dlang.org/spec/function.html#nogc-functions It is not indicated that "new" declarations may be compatible with "@nogc" functions provided that they are only used for "scope" variables. The following program compiles on the dlang.org website: ``` class Bob { int a; } void doThing() @nogc { scope auto b = new Bob(); } void main() { doThing(); } ``` --
[Issue 6318] module isn't fully processed under weird conditions
https://issues.dlang.org/show_bug.cgi?id=6318 Johannes Loherchanged: What|Removed |Added Status|NEW |RESOLVED CC||johannes.lo...@fg4f.de Resolution|--- |FIXED --- Comment #4 from Johannes Loher --- I don't know when this has been fixed, but with 2.080.0, I get both error messages in all cases: dmd -c -I.. Bar.d Handle.d Bar.d(13): Error: undefined identifier Msg foo ../basic/Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template flattenNamedEnum is not defined ../basic/Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity) bar dmd -c -I.. Bar.d Handle.d Messages.d Bar.d(13): Error: undefined identifier Msg foo Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template flattenNamedEnum is not defined Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity) bar dmd -c -I.. Bar.d Messages.d Handle.d Bar.d(13): Error: undefined identifier Msg foo Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template flattenNamedEnum is not defined Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity) bar dmd -c -I.. Handle.d Bar.d foo ../basic/Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template flattenNamedEnum is not defined ../basic/Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity) bar Bar.d(13): Error: undefined identifier Msg dmd -c -I.. Bar.d Messages.d Handle.d Bar.d(13): Error: undefined identifier Msg foo Messages.d(11): Error: template instance `flattenNamedEnum!Severity` template flattenNamedEnum is not defined Messages.d(11):while evaluating pragma(msg, flattenNamedEnum!Severity) bar As this seems to work correctly, I'm closing this. --
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 12:32:38 UTC, Gheorghe Gabriel wrote: On Saturday, 5 May 2018 at 12:17:48 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:14:38 UTC, bachmeier wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Because it means that D is getting some exposure to industrial development! Absolutely. This, not [technical feature X], is what will lead to adoption of D. Agreed! D can have all these nice features, but what matters in enterprise development is what frameworks D had that can be used in productivity and not just for projects you code at home. That was the sole reason I did Diamond too. I focused on having it fit for enterprise development since the beginning. I love Diamond! It is my favorite framework written in D so far. I've been working on a big project in D for three weeks, after one year of D experience. Can't wait to finally expose it. Thank you so much! When you get started with it, don't hesitate to ask me about stuff!
[Issue 18829] New: pragma msg of int incoherent
https://issues.dlang.org/show_bug.cgi?id=18829 Issue ID: 18829 Summary: pragma msg of int incoherent Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: ol...@fg4f.de When working with pragma(msg,...) in relation to https://issues.dlang.org/show_bug.cgi?id=7947 I stumbled upon the following behaviour: pragma(msg, typeof(int.init)); // Works: int pragma(msg, int); // Fails: // Error: found `)` when expecting `.` following int // Error: found `;` when expecting identifier following `int`. // ... // but, obviously: static assert(is(typeof(int.init) == int)); This seems to be related to `int` being a keyword, as everything works when using an arbitrary struct. --
unit-threaded v0.7.45 - now with more fluency
For those not in the know, unit-threaded is an advanced testing library for D that runs tests in threads by default. It has a lot of features: http://code.dlang.org/packages/unit-threaded New: * Bug fixes * Better integration testing * unitThreadedLight mode also runs tests in threads * More DDoc documentation (peer pressure from Adam's site) * Sorta kinda fluent-like asserts On the new asserts (should and should.be are interchangeable): 1.should == 1 1.should.not == 2 1.should.be in [1, 2, 3] 4.should.not.be in [1, 2, 3] More controversially (due to a lack of available operators to overload): // same as .shouldApproxEqual 1.0.should ~ 1.0001; 1.0.should.not ~ 2.0; // same as .shouldBeSameSetAs [1, 2, 3].should ~ [3, 2, 1]; [1, 2, 3].should.not ~ [1, 2, 2]; I also considered adding `.should ~=`. I think it even reads better, but apparently some people don't. Let me know? The operator overloads are completely optional. Atila
Re: auto: useful, annoying or bad practice?
On Monday, 30 April 2018 at 21:31:48 UTC, Giles Bathgate wrote: On Monday, 30 April 2018 at 21:11:07 UTC, Gerald wrote: [...] It takes some getting used to. Type inference is useful because often you don't care/know, or want to type out the full name of the type for every variable. It does, however, assume that the developer can also do type inference (when/if you need to know the type). When it's not clear what the type is by looking at the right-hand side perhaps the codebase has bigger problems. functions that return auto are a bit odd IMHO, that is a feature unique to D. C++14 would beg to differ. As would any language with Hindley-Milner type inference. Atila
[Issue 5931] keyword new won't allow default initialization of a struct where it has a non-zero argument constructor
https://issues.dlang.org/show_bug.cgi?id=5931 Johannes Loherchanged: What|Removed |Added Status|NEW |RESOLVED CC||johannes.lo...@fg4f.de Resolution|--- |WONTFIX --- Comment #6 from Johannes Loher --- The first problem mentioned has been solved since 2.063. The second problem is still present, error message of 2.080.0: main.d(16): Error: none of the overloads of this are callable using argument types (File), candidates are: /usr/include/dlang/dmd/std/stdio.d(387): std.stdio.File.this(shared(_IO_FILE)* handle, string name, uint refs = 1u, bool isPopened = false) /usr/include/dlang/dmd/std/stdio.d(425):std.stdio.File.this(string name, const(char[]) stdioOpenmode = "rb") /usr/include/dlang/dmd/std/stdio.d(443):std.stdio.File.__ctor(R1, R2)(R1 name) if (isInputRange!R1 && isSomeChar!(ElementEncodingType!R1)) /usr/include/dlang/dmd/std/stdio.d(451):std.stdio.File.__ctor(R1, R2)(R1 name, R2 mode) if (isInputRange!R1 && isSomeChar!(ElementEncodingType!R1) && isInputRange!R2 && isSomeChar!(ElementEncodingType!R2)) The reason is in general, that you can't call postblits as if they were constructors (`File file; auto f = File(file);` also does not work). However, it seems that postblits will probably be replaced by some form of copy constructor, so this might even resolve this issue. I will close this for now. If you really want this feature, please submit a new issue as an enhancement request. --
[Issue 8256] mixin() doesn't work in a template declaration
https://issues.dlang.org/show_bug.cgi?id=8256 Oliver Rümpeleinchanged: What|Removed |Added Status|NEW |RESOLVED CC||ol...@fg4f.de Resolution|--- |WONTFIX --- Comment #5 from Oliver Rümpelein --- I consider this solved. Please reopen if there is any implicit, actual request associated with this. --
[Issue 8363] Empty array literal does not implicitly convert to associative array
https://issues.dlang.org/show_bug.cgi?id=8363 Oliver Rümpeleinchanged: What|Removed |Added Status|NEW |RESOLVED CC||ol...@fg4f.de Resolution|--- |WONTFIX --- Comment #6 from Oliver Rümpelein --- Starting with 2.071, you can use "aa.clear()" to achieve the desired behaviour. If you are still in the need for the proposed syntax, please reopen this issue or write a DIP (as this would modify the behaviour of the language). --
Re: Windows to Linux Porting - timeCreated and timeLastAccessed
On Fri, 2018-05-04 at 08:02 -0600, Jonathan M Davis via Digitalmars-d-learn wrote: > […] > Linux does not keep track of the creation time of a file. So, it will not > work to have a program on Linux ask a file how long it's been since the file > was created. If you want that information, you'll have to store it elsewhere […] Linux itself doesn't but most filesystems certainly do. Ext4 definitely does. https://unix.stackexchange.com/questions/7562/what-file-systems-on-linux-store -the-creation-time -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
[Issue 15732] std.function partial does not work with function / delegate references
https://issues.dlang.org/show_bug.cgi?id=15732 Marco de Wildchanged: What|Removed |Added CC||nanaya...@gmail.com Assignee|nob...@puremagic.com|nanaya...@gmail.com --
Re: Announcing Mecca
On 05/05/2018 04:09 AM, Joakim wrote: On Saturday, 5 May 2018 at 10:43:53 UTC, Mengu wrote: On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote: Hello everybody, I am very happy to announce that Mecca version 0.0.1 (sorry, no more zeros than that) is now officially available. You can get the source code at https://github.com/weka-io/mecca. The API documentation is at https://weka-io.github.com/mecca/docs. [...] why the name mecca? Liran said in his closing keynote that they use a lot of internal codenames that rhyme with Weka. Shachar further explained that they have internal tools and projects that all end with "eka" like teka. M was available, so they called it Meka, which sounded like an existing place so changed its name to Mecca. Ali
[Issue 5034] Ranged (or bounded) array initializer
https://issues.dlang.org/show_bug.cgi?id=5034 Johannes Loherchanged: What|Removed |Added CC||johannes.lo...@fg4f.de --- Comment #2 from Johannes Loher --- I believe this would definitely need a DIP. --
[Issue 5014] is(T U == super) returns non-shared parent types for shared(T)
https://issues.dlang.org/show_bug.cgi?id=5014 Johannes Loherchanged: What|Removed |Added CC||johannes.lo...@fg4f.de --- Comment #1 from Johannes Loher --- Still happening in 2.080.0. The spec states that U should be a TypeSeq of base classes and interfaces of T. What is the desired behaviour? This also happens for other attributes like const, immutable, and inout. std.traits.BaseTypeTuple has the same behaviour. --
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 12:17:48 UTC, Bauss wrote: On Saturday, 5 May 2018 at 12:14:38 UTC, bachmeier wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Because it means that D is getting some exposure to industrial development! Absolutely. This, not [technical feature X], is what will lead to adoption of D. Agreed! D can have all these nice features, but what matters in enterprise development is what frameworks D had that can be used in productivity and not just for projects you code at home. That was the sole reason I did Diamond too. I focused on having it fit for enterprise development since the beginning. I love Diamond! It is my favorite framework written in D so far. I've been working on a big project in D for three weeks, after one year of D experience. Can't wait to finally expose it.
[Issue 8063] Purity of assert's second parameter
https://issues.dlang.org/show_bug.cgi?id=8063 Oliver Rümpeleinchanged: What|Removed |Added Status|NEW |RESOLVED CC||ol...@fg4f.de Resolution|--- |FIXED --- Comment #2 from Oliver Rümpelein --- The output starting from 2.0.64 includes only the "Bad type size: 8"-message. Resolving. --
Re: Error: module `hello` is in file 'hello.d' which cannot be read
On Friday, 4 May 2018 at 23:29:12 UTC, Alex wrote: Hi I just installed D on my windows 10 and want to try to compile a hello world. My source is a classical import std.stdio; void main() { writeln("Hello, World!"); } And I try to compile and get C:\D>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import What do I do wrong ? D is installed at de root of C:, and the hello.d source code is at C:\D\dmd2\sources. Thank you to you Alex Try to add module hello; To the top of the file
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 12:14:38 UTC, bachmeier wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Because it means that D is getting some exposure to industrial development! Absolutely. This, not [technical feature X], is what will lead to adoption of D. Agreed! D can have all these nice features, but what matters in enterprise development is what frameworks D had that can be used in productivity and not just for projects you code at home. That was the sole reason I did Diamond too. I focused on having it fit for enterprise development since the beginning.
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Because it means that D is getting some exposure to industrial development! Absolutely. This, not [technical feature X], is what will lead to adoption of D.
Re: D as a college language
On Saturday, 5 May 2018 at 11:25:45 UTC, Russel Winder wrote: On Sat, 2018-05-05 at 03:02 +, KingJoffrey via Digitalmars-d wrote: […] Students should learn C first, Java second. Not one or the other, both! What is the pedegogy here, what are the justifications. That the languages being taught to undergrads, must be pervasive. That the languages being taught to undergrads, must teach them about low-level types, and higher-level types. And a whole lot of other stuff..(e.g, open source, cross platform, have multiple compilers, standardised, formalised, etc..) ..I can't be bothered typing any more ... In UK we have Scratch then Python then ??? This is working tremendously well to get large numbers of young people programming far better than most professional programmers. Don't teach undergrads how to play with toys! They can play with toys in junior high school, sure. Then, perhaps, they will begin to understand the basics of computer programming - from both extremes. C and Java are not extremes. Lisp, assembly language, Haskell, Erlang, these are extremes. C and Java, in comparison to each other, are at the end of each extreme. Those other languages you mention are mostly irrelevant (at least on a grand scale), and certainly non-pervasisve. They have no place in undergrad course. D could be a postgrad interest perhaps. No, this would be a bad idea.We can debate this elsewhere. That should depend on the interests of the postgrad. At some point, we really, really should let them choose to focus on what interests them. And what's earning an income got to do with anything? It's a stupid concept that humans have imposed on themselves, and it's the primary cause of all things that are wrong with society. The sooner we move to universal incomes, the better grauate programmers we'll get, cause they'll be studying it because it actually interests them, as opposed to being motived by its' 'earning' capacity. There being jobs using a programming language may not be a primary driver, but it is a secondary driver. University courses not using Java, Go, and JavaScript somewhere in the curriculum theses days get shunned by students. OK so all programming is clearly Web programming and nothing else is needed. :-) you forgot 'mobile'. So let me provide something actually constructive: Given that the world will move inexorably to using Python for teaching young people programming the trick is to have a Python → D learning programme with lots of support. Teaching support is everything in this aspect of the game. Python should be banned! Cut of it's head!! Teach the teachers that D is the route from Python to native code programming and thence C, C++, Fortran, etc, and you have an angle. Having an angle that appeals to the teachers is the first step in getting students to be taught a programming language. Java proved this. As someone intimately involved with a university for many, many years, I have to wonder whether teachers are the problem, rather than the solution ;-)
[Issue 4111] Foreach ranges accept floating-point extrema
https://issues.dlang.org/show_bug.cgi?id=4111 Johannes Loherchanged: What|Removed |Added Keywords|accepts-invalid | CC||johannes.lo...@fg4f.de Severity|normal |enhancement --- Comment #2 from Johannes Loher --- This still works as of 2.080.0 and the spec indeed does not state that only integral extrema are allowed. This is legal code at the moment. I'll tag this as enhancement. --
[Issue 12639] Struct-scoped import breaks UFCS
https://issues.dlang.org/show_bug.cgi?id=12639 Johannes Loherchanged: What|Removed |Added Status|NEW |RESOLVED CC||johannes.lo...@fg4f.de Resolution|--- |FIXED --- Comment #2 from Johannes Loher --- I tested this on diefferent compiler versions. It seems to work correctly since 2.071.2. --
Re: Is HibernateD dead?
On Friday, 4 May 2018 at 19:54:46 UTC, Matthias Klumpp wrote: I've written an email to Vadim, maybe we get a reply on the status of both projects. On Friday, 4 May 2018 at 07:18:09 UTC, bauss wrote: [...] Would it maybe be easier for you to base on ddbc[1] or another existing abstraction layer for database abstraction? Ddbc is pretty neat, and even has support for reading structs directly from the database. Perhaps, but it'd have to be a forked version as I don't really want to depend on something that isn't updated regularly. ddbc's last commit was a year ago. Yes, at the moment using ddbc and relying on it would mean taking over some maintenance of it. Ddbc is fairly complete though and might save you a lot of work, because it already abstracts a lot of (relational) database systems. I can't seem to find a license for it though? It's Boost licensed (BSL-1.0), but probably needs an explicit LICENSE file. Maybe we can move ddbc to dlang-community, so more people can easily commit changes to it (provided it gets accepted there, and Vadim agrees with that move as well). Perhaps I will end up having another "optional" dependency to it as a temporary until I can have a better implementation or something. Taking over maintenance of it might be easier than reimplementing the database abstraction again though. For Postgres, ddbc worked really well for me, and I assume its SQLite, MySQL and ODBC drivers are also still working well, meaning less work for you. Without ddbc, you'd have to write new abstraction on top of some other libraries, like dpq2. The frontend part of postgresql is almost finished, it's just having the postgresql driver working properly, which is where it's frozen right now. Hmm... Does any public code for that exist already that I could play around with? Unfortunately, I have a few more unusual requirements for Postgres, like: * UUIDs as primary keys, instead of integers As far as I remember the implementation of @DbId in Diamond, then it supports whatever type. Native support for std.uuid.UUID would be neat :-) For Hibernated I use a mixin to convert a UUID into strings transparently, for database insertion. Diamond doesn't care much about what type your primary key is. I will make sure that's how it function of course, if it currently doesn't behave like it, but I'm pretty sure it does. * Ability to register custom datatypes with the ORM (version numbers in this case, the ORM can view them as text, but the database has a special type for them) That could be done with some attribute that lets you handle columns yourself. Do you have a good name for it? I was thinking @DbProxy and then the function would be something like: [...] Registering a new type with Postgres yields a new OID to identify the type, so I would need a function to tell the Postgres backend to treat OIDs of a certain number like "text" types. Ideally, I would also need to annotate entity to set a specific column type, like: ``` class Entity { UUID uuid; @ColumType("versionnumber") string _version; } ``` (With the result of CREATE TABLE not setting a "text" type for the new version column, but a "versionnumber" type instead) That would do it. For Hibernated, I have Hibernated create the table initially, and then fire an ALTER TABLE at it afterwards to change the column type, while at the same time registering the new type OID with ddbc to be treated as text. As said, this is a very specific requirement very few people will have ^^ Much more frequently people will ask for JSONB and JSON type support for a postgres driver though, I guess. For that, specifying the column type explicitly could be quite helpful as well, so switch between JSONB and JSON. * Obviously the usual ORM stuff, one-to-many, many-to-many, etc. relations Yes, relations is one thing I haven't added and I have been wanting to do it for a while. I will definitely look into having it added as well. That's kind of key for an ORM :-) Handling relations manually was what made me abandon my "I just write raw SQL for everything" ways, because it gets quite complex and annoying in the long run. (Obviously not a must-have list, I added support for custom datatypes to my ddbc fork as well, because it's not really a feature many people need) Well, that's kind of the key to most of the development in Diamond. I usually add functionality that isn't widely used and in most cases people implement it themselves ex. the whole diamond.seo is not usually something a framework has. I keep an eye on it - at the moment, Vibe.d satisfies all requirements I have on a web framework, but that might change. A well integrated ORM would certainly be a game changer, since Vibe.d is limited to Mongo and Redis only. Diamond is a neat project, I played around with it about half a year ago, but didn't test the ORM part at all back then. It wasn't that
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 10:44:37 UTC, Mengu wrote: On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Read article here: https://stackshare.io/posts/dev-tools-roundup-april-2018 Why is this relevant? Because it means that D is getting some exposure to industrial development! congratulations! Thanks!
OST to PST Converter
It becomes easy to recover the damaged OST files with the help of ATS OST to PST Converter which is highly recommended by its users. it is very honest and reliable tool because of its highly rich algorithm. It converts the OST files into many different and important formats like EML, EMLX, vCard, vCal, MSG, and MBOX, then the best thing is that you can convert and save your OST data into Office 365 & Live Exchange Server which is a very important cloud-based application. It support window server 2003, 2003 R2, 2008, 2008 R2 2016. Get more details: http://www.bulkecommerce.com/store/ats-ost-to-pst-converter-software-159.html
Re: Funding for code-d/serve-d
On Saturday, 5 May 2018 at 11:21:29 UTC, Mike Parker wrote: This morning at the Hackathon I announced that the D Foundation is raising money for code-d/serve-d, the plugin for Visual Studio Code and its companion Microsoft Language Server Protocol implementation for D. We've set up a goal of $3000 at our Open Collective page: https://opencollective.com/dlang# At the top of the page, you'll see our current balance, the projected balance at the end of the year based on the current level of monthly donations, and the goal of $3000 on the far right. We're sitting at just over $1100 as I write this, which means we're almost halfway there already. We encourage those of you who use Webfreak's VS Code plugin to contribute whatever you can in order to fund its development, especially if you want to see it improve. An important point is that development on serve-d can ultimately benefit not just code-d, but other IDE and editor plugins where it may be used. If we reach $2700 within 30 days, the D Foundation will throw in the remaining $300 and we'll let Webfreak get to work. If this proves successful, we hope to use future goals to fund development across the D ecosystem. Some of our targets will be driven by the results of the recent State of D Survey and others will be driven by other concerns. If you are interested in helping to move the state of D development forward, please consider contributing! This is great! I'll donate at some point this month (probably near the endsame)
Re: D as a college language
On Sat, 2018-05-05 at 23:16 +1200, rikki cattermole via Digitalmars-d wrote: > […] > You're forgetting one crucial detail. The people making the decisions > now, are not the same ones back then. Not forgetting at all, but may be didn't make the point as well as I should. All universities are not the same. There are the leaders and there are the followers. Follower university departments emphasise job opportunities much more than leader university departments. The old university/polytechnic split in the UK used to highlight this very well. Leader departments value pedegogy and concepts much more than follower departments. Sadly in many cases this got labelled as "academic" vs "practical" which remains a very unfortunate way of categorising things. > I have repeated what I was told using all the same arguments presented > in this thread and I am only relaying it here their response. It isn't > my opinion. Understood. I will always say job opportunities is a secondary factor, just not a primary one. Except that in some follower departments they do not accept this, they are more about training and less about education. For them job opportunities are everything: training not education. -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: D as a college language
On Sat, 2018-05-05 at 03:02 +, KingJoffrey via Digitalmars-d wrote: […] > > Students should learn C first, Java second. Not one or the other, > both! What is the pedegogy here, what are the justifications. In UK we have Scratch then Python then ??? This is working tremendously well to get large numbers of young people programming far better than most professional programmers. > Then, perhaps, they will begin to understand the basics of > computer programming - from both extremes. C and Java are not extremes. Lisp, assembly language, Haskell, Erlang, these are extremes. > D could be a postgrad interest perhaps. No, this would be a bad idea.We can debate this elsewhere. > And what's earning an income got to do with anything? It's a > stupid concept that humans have imposed on themselves, and it's > the primary cause of all things that are wrong with society. The > sooner we move to universal incomes, the better grauate > programmers we'll get, cause they'll be studying it because it > actually interests them, as opposed to being motived by its' > 'earning' capacity. There being jobs using a programming language may not be a primary driver, but it is a secondary driver. University courses not using Java, Go, and JavaScript somewhere in the curriculum theses days get shunned by students. OK so all programming is clearly Web programming and nothing else is needed. :-) So let me provide something actually constructive: Given that the world will move inexorably to using Python for teaching young people programming the trick is to have a Python → D learning programme with lots of support. Teaching support is everything in this aspect of the game. Teach the teachers that D is the route from Python to native code programming and thence C, C++, Fortran, etc, and you have an angle. Having an angle that appeals to the teachers is the first step in getting students to be taught a programming language. Java proved this. -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Funding for code-d/serve-d
This morning at the Hackathon I announced that the D Foundation is raising money for code-d/serve-d, the plugin for Visual Studio Code and its companion Microsoft Language Server Protocol implementation for D. We've set up a goal of $3000 at our Open Collective page: https://opencollective.com/dlang# At the top of the page, you'll see our current balance, the projected balance at the end of the year based on the current level of monthly donations, and the goal of $3000 on the far right. We're sitting at just over $1100 as I write this, which means we're almost halfway there already. We encourage those of you who use Webfreak's VS Code plugin to contribute whatever you can in order to fund its development, especially if you want to see it improve. An important point is that development on serve-d can ultimately benefit not just code-d, but other IDE and editor plugins where it may be used. If we reach $2700 within 30 days, the D Foundation will throw in the remaining $300 and we'll let Webfreak get to work. If this proves successful, we hope to use future goals to fund development across the D ecosystem. Some of our targets will be driven by the results of the recent State of D Survey and others will be driven by other concerns. If you are interested in helping to move the state of D development forward, please consider contributing!
Re: Need help with the dmd package on NixOS
On Saturday, 5 May 2018 at 00:07:01 UTC, Johannes Loher wrote: Am 04.05.2018 um 22:27 schrieb Thomas Mader: [...] Here is a demangled version of what you posted: Here comes the entire demangled output of the Hello World build. Maybe it has something to do with ModuleInfo? I also need to skip through changes which might have introduced this problem. hello.o: In function `@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])': hello.d:(.text.@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0x46): undefined reference to `@safe std.stdio.File.LockingTextWriter std.stdio.File.lockingTextWriter()' hello.d:(.text.@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0x57): undefined reference to `@safe void std.stdio.File.__dtor()' hello.d:(.text.@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])[@safe void std.stdio.writeln!(immutable(char)[]).writeln(immutable(char)[])]+0xa4): undefined reference to `@trusted void std.stdio.File.LockingTextWriter.__aggrDtor()' hello.o:(.data.DW.ref.__dmd_personality_v0+0x0): undefined reference to `__dmd_personality_v0' hello.o: In function `@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])': hello.d:(.text.@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x20): undefined reference to `std.exception.ErrnoException.__Class' hello.d:(.text.@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x5b): undefined reference to `@trusted std.exception.ErrnoException std.exception.ErrnoException.__ctor(immutable(char)[], immutable(char)[], ulong)' hello.d:(.text.@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])[@safe int std.exception.errnoEnforce!(int, "/nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/include/d2/std/stdio.d", 2877uL).errnoEnforce(int, lazy immutable(char)[])]+0x63): undefined reference to `_d_throwdwarf' hello.o: In function `@safe void std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))': hello.d:(.text.@safe void std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))[@safe void std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))]+0x1b): undefined reference to `@property @trusted core.stdc.stdio._IO_FILE* std.stdio.File.LockingTextWriter.handle_()' hello.d:(.text.@safe void std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))[@safe void std.stdio.File.LockingTextWriter.put!(immutable(char)).put(immutable(char))]+0x37): undefined reference to `@property @trusted core.stdc.stdio._IO_FILE* std.stdio.File.LockingTextWriter.handle_()' hello.o: In function `@safe void std.stdio.File.LockingTextWriter.put!(char).put(char)': hello.d:(.text.@safe void std.stdio.File.LockingTextWriter.put!(char).put(char)[@safe void std.stdio.File.LockingTextWriter.put!(char).put(char)]+0x1b): undefined reference to `@property @trusted core.stdc.stdio._IO_FILE* std.stdio.File.LockingTextWriter.handle_()' hello.d:(.text.@safe void std.stdio.File.LockingTextWriter.put!(char).put(char)[@safe void std.stdio.File.LockingTextWriter.put!(char).put(char)]+0x37): undefined reference to `@property @trusted core.stdc.stdio._IO_FILE* std.stdio.File.LockingTextWriter.handle_()' hello.o: In function `main': hello.d:(.text.main[main]+0xc): undefined reference to `_d_run_main' /nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/lib/libphobos2.a(lifetime_68e_482.o):(.data+0x0): undefined reference to `rt.lifetime.__ModuleInfo' /nix/store/x9wfppgz07zgks9yfn7c96965wmrl0xd-dmdBuild-2.079.1/lib/libphobos2.a(lifetime_68e_482.o): In function `_d_newclass': (.text._d_newclass[_d_newclass]+0x35): undefined reference to `pure nothrow @nogc core.exception.OutOfMemoryError core.exception.staticError!(core.exception.OutOfMemoryError).staticError()' (.text._d_newclass[_d_newclass]+0x3d): undefined reference to `_d_throwdwarf'
Re: D as a college language
On 05/05/2018 11:06 PM, Russel Winder wrote: On Sat, 2018-05-05 at 03:22 +1200, rikki cattermole via Digitalmars-d wrote: […] Teaching materials is easy to create. My response is the response I got from my institution. It is industry usage which is the problem. Nobody wants to take the risk without being able to point and say "they" are using it for some serious work. Let me take you back to 1994. Universities teaching Scheme, Miranda, C++, or if they were a bit backward Pascal or even Modula-2. Java comes along and all universities switched to it and created vast amounts of teaching material. Absolutely no industrial take up at all. You're forgetting one crucial detail. The people making the decisions now, are not the same ones back then. I have repeated what I was told using all the same arguments presented in this thread and I am only relaying it here their response. It isn't my opinion.
Re: D as a college language
On Fri, 2018-05-04 at 11:52 +, bauss via Digitalmars-d wrote: > […] > > The biggest issue is that there isn't much industrial work done > in D and that's why it's not taught. Perhaps this argument is used in some places, but it is not the primary driver for choice of programming languages in universities. It is a secondary factor though certainly. > When you're taught to program in specific languages, it's because > those languages are where the job market is at. In some training courses, yes, in universities no. > I completely agree with your post however, but I don't see D ever > taking off as an educational programming language in the majority > of schools, because it doesn't have a job market to support it. Not a primary argument. The single biggest reason why D is not taught in universities is that D is not taught in universities. There are many fashion and herd aspects to teaching programming. The leaders will choose a language for pedagogical reasons, mixed a bit with jobs market, and will create teaching materials. All the rest just follow what the leaders decide using the leaders materials if at all possible so as to avoid having to make their own. > Say if you apply for a Java job and it says you have 10 years of > experience programming in D and 3 years of experience programming > Java, then another applicant has 7 years of experience > programming in Java, but 0 experience with programming in D. > > To the one hiring the person with 7 years of experience seem like > a better choice, just because they generally have no idea what D > is and what it offers. They don't know that if you program in D > you can usually program very well, if not better than most > general Java developers __when__ using Java. All they know is > that they use Java and they're looking for the one with most > experience in that field. If this is the jobs market you have experienced you are applying to the wrong companies. Experience (as debated in other threads) is a problematic concept. Having worked for 10 years in C++ doesn't mean you have 10 years constructive experience; someone with 6 months might be a better programmer and thus chosen. Of course cost of person is a factor as well. Remember though someone with 1 year Haskell, 1 year Lisp, 1 year C++, and 1 year Java, may well be a better D programmer than someone with 10 years D experience. > Until D becomes an industrial requirement, then it will not be > taught. > > That's why D is a hobby language. N. D seems to be a hobby language because everyone says this in public forums. D is a programming language, some use it for hobby, some for hard core industrial and commercial. It is just that it's traction is not high. -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: Announcing Mecca
On Saturday, 5 May 2018 at 10:43:53 UTC, Mengu wrote: On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote: Hello everybody, I am very happy to announce that Mecca version 0.0.1 (sorry, no more zeros than that) is now officially available. You can get the source code at https://github.com/weka-io/mecca. The API documentation is at https://weka-io.github.com/mecca/docs. [...] why the name mecca? Liran said in his closing keynote that they use a lot of internal codenames that rhyme with Weka.
Re: D as a college language
On Sat, 2018-05-05 at 03:22 +1200, rikki cattermole via Digitalmars-d wrote: > […] > Teaching materials is easy to create. > My response is the response I got from my institution. > It is industry usage which is the problem. > > Nobody wants to take the risk without being able to point and say "they" > are using it for some serious work. Let me take you back to 1994. Universities teaching Scheme, Miranda, C++, or if they were a bit backward Pascal or even Modula-2. Java comes along and all universities switched to it and created vast amounts of teaching material. Absolutely no industrial take up at all. -- Russel. == Dr Russel Winder t: +44 20 7585 2200 41 Buckmaster Roadm: +44 7770 465 077 London SW11 1EN, UK w: www.russel.org.uk signature.asc Description: This is a digitally signed message part
Re: Dconf live stream for Shachar's talk
On Saturday, 5 May 2018 at 07:56:21 UTC, Steven Schveighoffer wrote: Hi all, We are live streaming Shachar's talk this morning at https://www.youtube.com/watch?v=xNWRgEHxOhc Ali is uploading the slides to dconf.org so you can follow along. Thanks! The link still works, watching it now.
Re: Announcing Mecca
On Friday, 4 May 2018 at 05:23:51 UTC, Shachar Shemesh wrote: Hello everybody, I am very happy to announce that Mecca version 0.0.1 (sorry, no more zeros than that) is now officially available. You can get the source code at https://github.com/weka-io/mecca. The API documentation is at https://weka-io.github.com/mecca/docs. [...] why the name mecca?
Re: Diamond mentioned in stackshare.io article
On Saturday, 5 May 2018 at 10:00:16 UTC, Bauss wrote: Read article here: https://stackshare.io/posts/dev-tools-roundup-april-2018 Why is this relevant? Because it means that D is getting some exposure to industrial development! congratulations!
Re: Error: module `hello` is in file 'hello.d' which cannot be read
Thank you for you for your quick answer. I think I allready tryed this, before asking, but ... C:\>cd D\dmd2\sources C:\D\dmd2\sources>dmd hello.d Error: module `hello` is in file 'hello.d' which cannot be read import path[0] = C:\D\dmd2\windows\bin\..\..\src\phobos import path[1] = C:\D\dmd2\windows\bin\..\..\src\druntime\import C:\D\dmd2\sources>
Re: Store any callable in an array
On 05/05/2018 02:30 AM, Neia Neutuladh wrote: On Friday, 4 May 2018 at 19:12:16 UTC, ag0aep6g wrote: If toDelegate isn't (always) @safe, how can you be sure that your wrapper is? [...] Looking at the code, I believe there are several casts that the compiler can't verify but are used safely. If you're right and the casts are used safely, and if that's the one thing that makes toDelegate @system, then toDelegate should be marked as @trusted. Or the casts should be @trusted, if they can be isolated like that. But belief isn't strong enough for that. You should be certain when applying @trusted. And thinking of all the ways that code might be unsafe is tricky, especially when you're dealing with arbitrary types in a template. Also, TFunc may have an unsafe destructor. [...]> If it's a user-defined type with opCall, that's something to pay attention to, but it's beyond the scope of the original question. That's the one. The scope of the original question doesn't matter if you don't restrain your function in the same way. Your function accepts structs, so you have to take them into account. Also, the thread is about "anything" callable. That includes structs with opCall.
Diamond mentioned in stackshare.io article
Read article here: https://stackshare.io/posts/dev-tools-roundup-april-2018 Why is this relevant? Because it means that D is getting some exposure to industrial development!
Re: On emulating C++ Namespaces (don't ask why)
On Friday, 4 May 2018 at 19:19:19 UTC, Manu wrote: On 4 May 2018 at 10:50, 0x via Digitalmars-dwrote: What am I violating here apart from the truth that our Mr. Walter doesn't like namespaces: interface tlvs { enum tlv { addr }; static: void header(); } Is this cool? Thanks But... modules? I did intentionally sidelined modules, not an option
Re: Is HibernateD dead?
On Thursday, 3 May 2018 at 10:27:47 UTC, Pasqui23 wrote: Last commit on https://github.com/buggins/hibernated was almost a year ago So what is the status of HibernateD?Should I use it if I need an ORM? Or would I risk unpatched security risks? You can use Entity & Database library: https://github.com/huntlabs/entity https://github.com/huntlabs/database
Re: Dconf live stream for Shachar's talk
On Saturday, 5 May 2018 at 07:59:48 UTC, Steven Schveighoffer wrote: On 5/5/18 9:56 AM, Steven Schveighoffer wrote: Hi all, We are live streaming Shachar's talk this morning at https://www.youtube.com/watch?v=xNWRgEHxOhc Ali is uploading the slides to dconf.org so you can follow along. Cheers! I will note that we don't have the normal A/V crew from the other days, so this is being done via a laptop camera. So you will probably need to download the slides. -Steve Thanks, watching it now. :)
Re: D for microservices
On Sunday, 11 March 2018 at 11:10:09 UTC, Tamas wrote: On Thursday, 8 March 2018 at 22:53:11 UTC, aberba wrote: On Thursday, 8 March 2018 at 09:35:08 UTC, Andrew Benton wrote: On Thursday, 8 March 2018 at 07:54:29 UTC, Jacob Carlborg wrote: On Thursday, 8 March 2018 at 07:20:53 UTC, Radu wrote: This guys says that vide.d works https://forum.dlang.org/thread/gikoeutmdyvolfshp...@forum.dlang.org Yes, it's pretty straightforward: 1. Build on Ubuntu, or some other dist 2. Statically link the whole binary with LDC, then you don't need to use Musl 3. Run it on Alpine -- /Jacob Carlborg Looks like that works out much nicer than using alpine as the first stage right now. I'm not sure anyone will be too upset about the extra 7MB. Building directly in alpine will simplify automated builds too. Simple Vibe.d app talking to Redis, packed into docker containers: https://github.com/tam4s/hello-redis The takeaway is that I could not use Alpine as a host image, because I could not build the app statically on ubuntu. warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking I've put up a new binary release of ldc 1.9 for Alpine, which fixes the vibe.d issues by pulling in two upstream commits from druntime, adds druntime and Phobos as shared libraries, and includes dub and rdmd: https://github.com/ldc-developers/ldc/releases I tested by unpacking that release in an Alpine VPS, adding its bin/ to my path, and simply running the following: dub fetch vibe-d dub build vibe-d The list of Alpine packages needed to run ldc are listed in the release notes. You can also cross-compile using the regular linux build of ldc by using ldc-build-runtime, the included tool to rebuild the stdlib for other platforms, and these instructions from the wiki: https://wiki.dlang.org/Building_LDC_runtime_libraries#Usage_for_cross-compilation I'm looking at adding a flag to dmd to enable building for the Musl C runtime: https://github.com/dlang/dmd/pull/8020 While the Musl port is mostly there, it appears that yshui didn't bother porting all of druntime, so there may still be other dub packages that need other missing C declarations. However, I'm done working on this port, beyond finishing off the above pull and the druntime pull linked from the release notes, as I don't use Alpine, containers, or microservices. I simply chipped in because I have porting experience and thought I could push D for microservices a bit farther along. I'll keep putting out official builds of ldc for Alpine though, as long as there's demand for them. If you'd like to use D in Alpine containers, now's the time to contribute to whatever else is missing. A good idea of the current status can be found in the first post of the dmd pull linked above. This may be a good project for the hackathon, as it's mostly polishing up a bunch of small things.
Re: Dconf live stream for Shachar's talk
On 5/5/18 9:56 AM, Steven Schveighoffer wrote: Hi all, We are live streaming Shachar's talk this morning at https://www.youtube.com/watch?v=xNWRgEHxOhc Ali is uploading the slides to dconf.org so you can follow along. Cheers! I will note that we don't have the normal A/V crew from the other days, so this is being done via a laptop camera. So you will probably need to download the slides. -Steve
Dconf live stream for Shachar's talk
Hi all, We are live streaming Shachar's talk this morning at https://www.youtube.com/watch?v=xNWRgEHxOhc Ali is uploading the slides to dconf.org so you can follow along. Cheers! -Steve
Re: D as a college language
On 5/4/2018 4:35 AM, Sjoerd Nijboer wrote: Since D seems to be a language that supports a lot of programming paradigms very well, wouldn't it be beneficial to learn people declarative programming using D for a little and from there expose them to other programming styles in thesame language to lower the barrier of entry? I agree that D being a multi-paradigm language makes it ideal as a vehicle for teaching various paradigms. New paradigms can be taught without the diversion of having to start over learning a new language.
Re: auto: useful, annoying or bad practice?
On 05/04/2018 12:54 PM, H. S. Teoh wrote: This is a good point. However, I'm failing to see it as a big problem, because for it to be a problem in the first place, you have to have *deliberately* passed an object of said type into a function that expects that particular concept. First of all, just to be clear in case I wasn't, I didn't mean that it's equally dangerous as globals, just that it's analogous. Globals are, of course, more dangerous. Regarding the need to deliberately pass an object of said type to a function in order to cause a problem, that's not always true: It could be a matter of the compiler choosing the wrong overload. Or sticking it in the wrong parameter on certain templated functions. Also, generally speaking, even without structural typing, the danger of passing an object of the wrong type to the wrong parameter/function/overload IS considered to be significant enough to help justify the whole premise of static typing. (Well, at least according to a certain faction of programmers, anyway ;) ) And ultimately, from a design standpoint, I really see no compelling reason *not* to require a formal declaration of "This deliberately implements isXYZ", other than just...some people just dislike it. So like, yea, we *can* get by without it...but...why would we want to?