Re: We need an internal keyword.

2018-10-21 Thread Neia Neutuladh via Digitalmars-d
On Sun, 21 Oct 2018 08:40:36 +, Laurent Tréguier wrote: > This is by design; the D way of dealing with this would be to split the > module into a package with multiple modules. This is often a usable way of doing things, but sometimes not so much. If you're writing a script for use with dub

Re: D alternative for node.js's socket.IO?

2018-10-21 Thread Neia Neutuladh via Digitalmars-d
On Sun, 21 Oct 2018 20:58:23 +, Fleel wrote: > Can std.socket provide a realtime connection between the client(web > browser) and the server, like for a chatroom or realtime multiplayer > game? Yes, but it will be a bit of work -- you'd need to implement a webserver by hand that can upgrade

Re: shared - i need it to be useful

2018-10-21 Thread Neia Neutuladh via Digitalmars-d
On Sun, 21 Oct 2018 12:04:16 -0700, Manu wrote: > On Sun, Oct 21, 2018 at 12:00 PM Timon Gehr via Digitalmars-d > wrote: >> Note that there may well be a good way to get the good properties of MP >> without breaking the type system, but MP itself is not good because it >> breaks @safe. > > Show

Re: Passing $ as a function argument

2018-10-10 Thread Neia Neutuladh via Digitalmars-d
On 10/10/2018 01:46 AM, James Japherson wrote: Would be nice to be able to pass $ as a function argument to be used in automatic path length traversing. $ only works in indexing operations because that's required to figure out what it refers to. However, you can mostly use it as a readonly

Re: A Friendly Challenge for D

2018-10-10 Thread Neia Neutuladh via Digitalmars-d
On 10/10/2018 03:05 PM, Jabari Zakiya wrote: https://www.scribd.com/doc/228155369/The-Segmented-Sieve-of-Zakiya-SSoZ It would be great if you could provide a link to a freely downloadable version of this.

Re: Passing $ as a function argument

2018-10-10 Thread Neia Neutuladh via Digitalmars-d
On 10/10/2018 05:01 PM, James Japherson wrote: All I'm proposing is to to allow one to escape that syntax to function calls. foo(int index) {    return arr[index]; } and D can support foo($-1); which simply gets translated in to arr[arr.length - 1] I think you might have a

Re: This is why I don't use D.

2018-10-06 Thread Neia Neutuladh via Digitalmars-d
On 10/06/2018 01:38 AM, 0xEAB wrote: The "tests" check doesn't seem to work properly for DMD <= v2.072.0. If one looks at the reports[0] for those compilers, one will that pretty everything failed. For example, `discord-rpc`[1] doesn't even have any unittests. I'm clearing out those build

Re: Static foreach bug?

2018-09-03 Thread Neia Neutuladh via Digitalmars-d
On Monday, 3 September 2018 at 04:43:30 UTC, bauss wrote: On Sunday, 2 September 2018 at 20:01:08 UTC, Neia Neutuladh wrote: On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could have each statement into a variable that could be maintained

Re: Static foreach bug?

2018-09-02 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 2 September 2018 at 19:42:20 UTC, bauss wrote: Woud be so much more maintainable if I could have each statement into a variable that could be maintained properly. You could extract the body of the static foreach into a [template] function.

Re: Half-baked thought: Out-of-process asserts

2018-09-04 Thread Neia Neutuladh via Digitalmars-d
On Tuesday, 4 September 2018 at 03:39:04 UTC, Nick Sabalausky (Abscissa) wrote: Discussion questions: - What would be the feasibility of the various parts of this? You'd need to interrupt the process. You'd need a parent process that detects the interrupt. Then you'd need to use the debugger

Re: Truly @nogc Exceptions?

2018-09-20 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 15:52:15 UTC, H. S. Teoh wrote: Yeah, that's what I meant. :D Well, for backward compatibility we could still have .msg allocate and return a string, but we could provide an overload / alternate member function that writes directly to a sink instead. Then we

Re: Jai compiles 80,000 lines of code in under a second

2018-09-20 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 23:13:38 UTC, aliak wrote: Alo! I just watched this talk from Jonathan Blow [0] about his programming language called Jai, and he can now compile an 80,000 line game in about 1.5 seconds on a laptop (of course I have no idea what laptop he's using), under 1

Re: This is why I don't use D.

2018-09-19 Thread Neia Neutuladh via Digitalmars-d
On Monday, 10 September 2018 at 01:27:20 UTC, Neia Neutuladh wrote: Not on dlang.org anywhere, but I built a crude version of this. Results are available at http://ikeran.org/report/. A quick status update: Per-package reports and build badges are now a thing.

Re: Jai compiles 80,000 lines of code in under a second

2018-09-21 Thread Neia Neutuladh via Digitalmars-d
On Friday, 21 September 2018 at 13:28:47 UTC, aliak wrote: Sure, all true, but from what I've seen of Jai, it's not a simple language, and it does a decent amount of compile time stuff, but who knows, maybe the code is simple indeed. I remember a demo where he ran a game at compile time and

Re: This is why I don't use D.

2018-09-21 Thread Neia Neutuladh via Digitalmars-d
On Friday, 21 September 2018 at 20:49:54 UTC, 0xEAB wrote: On Thursday, 20 September 2018 at 17:06:43 UTC, Neia Neutuladh wrote: The tester is now submodule-aware and I removed builds for packages with a `.gitmodules` file. I'm not sure whether this is actually a good idea. There are some

Re: Updating D beyond Unicode 2.0

2018-09-21 Thread Neia Neutuladh via Digitalmars-d
On Friday, 21 September 2018 at 23:17:42 UTC, Seb wrote: A: Wait. Using emojis as identifiers is not a good idea? B: Yes. A: But the cool kids are doing it: The C11 spec says that emoji should be allowed in identifiers (ISO publication N1570 page 504/522), so it's not just the cool kids.

Re: Updating D beyond Unicode 2.0

2018-09-21 Thread Neia Neutuladh via Digitalmars-d
On Friday, 21 September 2018 at 20:25:54 UTC, Walter Bright wrote: But identifiers? I haven't seen hardly any use of non-ascii identifiers in C, C++, or D. In fact, I've seen zero use of it outside of test cases. I don't see much point in expanding the support of it. If people use such

Re: Updating D beyond Unicode 2.0

2018-09-22 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 04:54:59 UTC, Joakim wrote: To wit, Windows linker error with Unicode symbol: https://github.com/ldc-developers/ldc/pull/2850#issuecomment-422968161 That's a good argument for sticking to ASCII for name mangling. I'm torn. I completely agree with Adam and

Re: Updating D beyond Unicode 2.0

2018-09-22 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 12:24:49 UTC, Shachar Shemesh wrote: If memory serves me right, hieroglyphs actually represent consonants (vowels are implicit), and as such, are most definitely "characters". Egyptian hieroglyphics uses logographs (symbols representing whole words, which

Re: Updating D beyond Unicode 2.0

2018-09-22 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 12:35:27 UTC, Steven Schveighoffer wrote: But aren't we arguing about the wrong thing here? D already accepts non-ASCII identifiers. Walter was doing that thing that people in the US who only speak English tend to do: forgetting that other people speak other

Re: Updating D beyond Unicode 2.0

2018-09-22 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 08:52:32 UTC, Jonathan M Davis wrote: Unicode identifiers may make sense in a code base that is going to be used solely by a group of developers who speak a particular language that uses a number a of non-ASCII characters (especially languages like Chinese or

Re: Warn on unused imports?

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 12:39 AM, FeepingCreature wrote: On Tuesday, 25 September 2018 at 19:28:47 UTC, Jacob Carlborg wrote: The DMD compiler is available as a library. A linter tool can be based on that. Repeating it here: the library does not have version-tagged releases. For a build system based

Re: Warn on unused imports?

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 02:51 AM, FeepingCreature wrote: On Wednesday, 26 September 2018 at 08:37:12 UTC, Dejan Lekic wrote: I humbly believe this does not belong to the compiler. These sort of things belong to a static code analyser TOOL. Think of checkstyle/findbugs in Java, or flake8/pep8 in Python

Re: Calling nested function before declaration

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 03:46 PM, Jonathan wrote: I can't see how the current behavior is at all better or to be preferred unless it is faster to compile?  What is the reason for it being how it is? void outerFunction() { func(); auto lock = acquireLock(); void nested() { } } Inside `nested`,

Re: Updating D beyond Unicode 2.0

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 01:43 PM, Walter Bright wrote: Don't most languages have a Romanji-like representation? Yes, a lot of languages that don't use the Latin alphabet have standard transcriptions into the Latin alphabet. Standard transcriptions into ASCII are much less common, and newer Unicode

Re: D IDE

2018-09-26 Thread Neia Neutuladh via Digitalmars-d
On 09/26/2018 08:23 PM, Nick Sabalausky (Abscissa) wrote: On 09/05/2018 01:34 PM, ShadoLight wrote: I sometimes wonder if the Vim/Emacs 'affectionados' spend so much time mastering their editors (which by all accounts have a steep learning curve), that they forgot that IDE development did

Re: phobo's std.file is completely broke!

2018-09-19 Thread Neia Neutuladh via Digitalmars-d
On Wednesday, 19 September 2018 at 08:54:42 UTC, Vladimir Panteleev wrote: BTW, something follows from the above: write(`C:\` ~ (short path) ~ `con`) will fail but: write(`C:\` ~ (long path) ~ `con`) will succeed. This is just one issue I've noticed... there's probably more lurking.

Re: phobo's std.file is completely broke!

2018-09-19 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 03:15:20 UTC, Vladimir Panteleev wrote: When the OS itself fails to properly deal with such files, I don't think D has any business in *facilitating* their creation by default. Dear lord Windows is terrible. Can we just deprecate it?

Re: This is why I don't use D.

2018-09-19 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 02:51:52 UTC, Neia Neutuladh wrote: On Monday, 10 September 2018 at 01:27:20 UTC, Neia Neutuladh wrote: Not on dlang.org anywhere, but I built a crude version of this. Results are available at http://ikeran.org/report/. A quick status update: And source

Re: dub auto-tester

2018-09-19 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 04:41:21 UTC, Joakim wrote: Nice, what will it take to get this integrated with the official dub website? I need to: * add JSON output to the auto-tester * get the dub registry to scrape the data (or, optionally, push the data to the registry, but that opens

Re: This is why I don't use D.

2018-09-20 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 06:41:54 UTC, drug wrote: Autotester should show build logs because for example `nanogui` package reported as failed although it builds on my machines successfully. The tester is now submodule-aware and I removed builds for packages with a `.gitmodules`

Re: Rather D1 then D2

2018-09-23 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 20:34:50 UTC, 0xEAB wrote: On Saturday, 22 September 2018 at 19:41:16 UTC, JN wrote: Some code will break, sure, but it's a mechanical change that should be possible to apply by some tool. Who will run this tool? Who's gonna merge the PRs created with this

Re: Rather D1 then D2

2018-09-23 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 23 September 2018 at 13:55:02 UTC, Guillaume Piolat wrote: AFAIK if you port D1 code the only problem is with immutable(char)[] instead of string, and the only thing to know is that immutable(T) and T implicitely convert to const(T). A lot of D1 code was 32-bit only, so there will

Re: Updating D beyond Unicode 2.0

2018-09-22 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 22 September 2018 at 19:59:42 UTC, Erik van Velzen wrote: Nobody in this thread so far has said they are programming in non-ASCII. I did. https://git.ikeran.org/dhasenan/muzikilo

Re: Mobile is the new PC and AArch64 is the new x64

2018-09-20 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 20 September 2018 at 05:45:52 UTC, Laurent Tréguier wrote: Why did the iPhone, and after that the smartphone industry as a whole, completely crush the classic cell phones when they have such a poor battery life? Smartphones don't have everything previous phones had. The pros

Updating D beyond Unicode 2.0

2018-09-21 Thread Neia Neutuladh via Digitalmars-d
D's currently accepted identifier characters are based on Unicode 2.0: * ASCII range values are handled specially. * Letters and combining marks from Unicode 2.0 are accepted. * Numbers outside the ASCII range are accepted. * Eight random punctuation marks are accepted. This follows the C99

Re: Updating D beyond Unicode 2.0

2018-09-23 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 23 September 2018 at 21:12:13 UTC, Walter Bright wrote: D supports Unicode in identifiers because C and C++ do, and we want to be able to interoperate with them. Extending Unicode identifier support off into other directions, especially ones that break such interoperability, is just

Re: Updating D beyond Unicode 2.0

2018-09-23 Thread Neia Neutuladh via Digitalmars-d
On Monday, 24 September 2018 at 01:39:43 UTC, Walter Bright wrote: On 9/23/2018 3:23 PM, Neia Neutuladh wrote: Okay, that's why you previously selected C99 as the standard for what characters to allow. Do you want to update to match C11? It's been out for the better part of a decade, after

Re: Why the hell do exceptions give error in the library rather than the user code?

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 16:43:04 UTC, Josphe Brigmo wrote: It is because you are throwing inside your code. When the throw is from the library, it gives something like this: std.exception.ErrnoException@std/stdio.d(430): Cannot open file `/doesntexist' in mode `w' (Permission denied)

Re: Why the hell do exceptions give error in the library rather than the user code?

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 14:34:36 UTC, Josphe Brigmo wrote: std.file.FileException@C:\D\dmd2\windows\bin\..\..\src\phobos\std\file.d(3153): It is very annoying when the only error info I have is pointing to code in a library which tells me absolutely nothing about where the error

Re: Proposal: __not(keyword)

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 18:06:55 UTC, Adam D. Ruppe wrote: Here's the simple idea: __not(anything) just turns off whatever `anything` does in the compiler. From your lips to G*d's ears.

Re: dmd as a library for scripting/JIT?

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 16:02:36 UTC, dennis luehring wrote: i've got user defined flow charts in my C++ application that calling C/C++ Code - could be possible to embedd dmd as a library, generate D code out of my flow charts and execute the "compiled" code directly without doing file

Re: Proposal: __not(keyword)

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 18:13:49 UTC, Eugene Wissner wrote: Makes the code unreadable. You have to count all attributes in the file, then negate them. Nobody should write like this and therefore it is good, that there isn't something like __not. For @nogc, pure and so forth there were

Re: More fun with autodecoding

2018-09-15 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 15 September 2018 at 15:31:00 UTC, Steven Schveighoffer wrote: The problem I had was that it wasn't clear to me which constraint was failing. My bias brought me to "it must be autodecoding again!". But objectively, I should have examined all the constraints to see what was wrong.

Re: phobo's std.file is completely broke!

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Friday, 14 September 2018 at 19:42:39 UTC, Josphe Brigmo wrote: It's a bug, but how the hell can I reproduce examples when it depends on the file system? Something like this (though I don't know much about Windows, so this might be wrong): auto path = getcwd; auto dir =

Re: extern(C++, ns) is wrong

2018-09-14 Thread Neia Neutuladh via Digitalmars-d
On Saturday, 15 September 2018 at 00:07:44 UTC, Danni Coy wrote: So extern(C++,"ns") replaces the existing syntax It would be in addition, at least at first. The current syntax might be deprecated. and then improve D's general ability to hand functioning hijacking other functions would be

Re: Mobile is the new PC and AArch64 is the new x64

2018-09-16 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 16 September 2018 at 10:25:30 UTC, Dave Jones wrote: Because for about £300 you can get an intel NUC system with 120GB SSD, which is more powerful and more upgradeable than your £700 mobile device. And some people still want that. For the typical person, it's more likely that

Re: Mobile is the new PC and AArch64 is the new x64

2018-09-17 Thread Neia Neutuladh via Digitalmars-d
On Monday, 17 September 2018 at 15:47:14 UTC, Joakim wrote: Not sure why that matters if you agree with Kay that HTML is an abortion? :) I actually think it's great that mobile is killing off the web, as the Comscore usage stats I linked earlier show. HTML is a somewhat open standard. I'm

Re: int/longRe: DIP 1015--removal of integer & character literal conversion to bool--Final Review

2018-09-16 Thread Neia Neutuladh via Digitalmars-d
On Sunday, 16 September 2018 at 17:33:27 UTC, Steven Schveighoffer wrote: As precedent, we do have -transition=intpromote, which disables the requirement for casting smaller integers to int first. And -dip1000. Maybe it would be nice to have a generic -future=[changeid] flag. I'd like it if

Re: filtered imports

2018-09-13 Thread Neia Neutuladh via Digitalmars-d
On Thursday, 13 September 2018 at 11:58:40 UTC, rikki cattermole wrote: import std.stdio; import std.file; void chdir(R)(R path) { writeln("changing dir to ", path); std.file.chdir(path); } And if you don't want to write long qualified import names, just rename it: import sf =

Re: Mobile is the new PC and AArch64 is the new x64

2018-09-18 Thread Neia Neutuladh via Digitalmars-d
On Tuesday, 18 September 2018 at 07:53:31 UTC, Joakim wrote: On Monday, 17 September 2018 at 22:27:41 UTC, Neia Neutuladh wrote: On Monday, 17 September 2018 at 15:47:14 UTC, Joakim wrote: Not sure why that matters if you agree with Kay that HTML is an abortion? :) I actually think it's great

Re: Mobile is the new PC and AArch64 is the new x64

2018-09-11 Thread Neia Neutuladh via Digitalmars-d
On Tuesday, 11 September 2018 at 07:23:53 UTC, Joakim wrote: I agree with a lot of what you say here, but I'm not sure what you mean by "first class support for mobile." What exactly do you believe D needs to reach that level? Natural-feeling bindings to platform libraries that are not

Re: D outperformed by C++, what am I doing wrong?

2017-08-13 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 13 August 2017 at 06:09:39 UTC, amfvcg wrote: Hi all, I'm solving below task: Well, for one thing, you are preallocating in C++ code but not in D. On my machine, your version of the code completes in 3.175 seconds. Changing it a little reduces it to 0.420s: T[] result =

Re: Visual Studio Code code-d serve-d beta release

2017-08-05 Thread Neia Neutuladh via Digitalmars-d-announce
On Saturday, 5 August 2017 at 22:43:31 UTC, WebFreak001 wrote: I just released a beta version on the visual studio marketplace that allows you to try out the latest features of serve-d. Awesome! Once I worked around the binary placement issue, this actually gave me completion options, which

Re: What the hell is wrong with D?

2017-09-19 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta wrote: writeln(x + ((_win[0] == '@') ? w/2 : 0)); writeln(x + (_win[0] == '@') ? w/2 : 0); The first returns x + w/2 and the second returns w/2! Yeah, it sucks to have bugs like this crop up. I have enough

Re: opEquals code generation

2017-09-19 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 13:18:04 UTC, drug wrote: 19.09.2017 15:38, Steven Schveighoffer пишет: On 9/19/17 8:01 AM, drug wrote: I iterate over struct members and check against equality depending on member type. is there more simple/cleaner/better way to achieve this functionality?

Re: wstring hex literals

2017-09-20 Thread Neia Neutuladh via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 15:04:08 UTC, jmh530 wrote: testing_utf16.d(5): Error: Truncated UTF-8 sequence testing_utf16.d(6):while evaluating: static assert((_error_) == (wstring )) Failed: ["dmd", "-unittest", "-v", "-o-", "testing_utf16.d", "-I."]

Re: How to check if path is writable

2017-09-14 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 15 September 2017 at 01:42:02 UTC, Joseph wrote: Is there a cross-platform way in D to check if a path is writable? Try to write to it and see if you get an error.

Re: Tango + D2 + Mac

2017-10-16 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 17 October 2017 at 02:52:41 UTC, Fat_Umpalumpa wrote: I am having a lot of trouble trying to install Tango to use with D2 on my mac os Sierra. Is this even possible? Thanks! I take it you're using https://github.com/SiegeLord/Tango-D2 ? I tried it out about a year ago and it

Re: Struct List Human

2017-09-24 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 24 September 2017 at 16:13:30 UTC, dark777 wrote: when you execute and call Name: I type my name: Name: dark777 + [enter] and he does not jump to the next line to get the age This is what I want to know how to solve. Add a `writeln();` after reading input, maybe?

datefmt 1.0.0 released: parse datetimes and also format them

2017-12-12 Thread Neia Neutuladh via Digitalmars-d-announce
# Sales pitch If you've ever had to parse datetime input from multiple sources and everyone's standardized on ISO8601, you might have found out that that's not quite as standard as you'd wish. This is where datefmt helps you. --- import datefmt; auto expected = SysTime(Date(2010, 1, 1),

Blog post: using dynamic libraries in dub

2017-12-19 Thread Neia Neutuladh via Digitalmars-d-announce
From the "it's a hacky workaround but it's what we've got" department: how to use dynamic libraries in dub, with GtkD as the example. GtkD takes about 45MB on its own, and that means it can take a fair bit of time to build anything that depends on it -- even if it only uses a handful of

Re: datefmt 1.0.0 released: parse datetimes and also format them

2017-12-19 Thread Neia Neutuladh via Digitalmars-d-announce
On Monday, 18 December 2017 at 09:03:09 UTC, Andrea Fontana wrote: I think you should add some way to translate days/month in other language. That would be great! Unfortunately, it requires a decent locales library.

Re: Seperating class methods in a different module

2017-12-06 Thread Neia Neutuladh via Digitalmars-d-learn
On Thursday, 7 December 2017 at 02:32:03 UTC, helxi wrote: 1. How can I separate class methods from the declaration block? And how can I implement them in a separate module? module a; class Test { import b; mixin TestMethodImpl!(); } module b; template TestMethodImpl() { void foo(); }

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread Neia Neutuladh via Digitalmars-d-learn
On Thursday, 7 December 2017 at 16:39:14 UTC, kdevel wrote: But why do I have to use the prefix "mymod.:" in the library case? If you have an editor open with ten tabs pointing to different files in your source tree, all your imports are uniform -- you don't have to step back and consider

Re: std.conv.to!string refuses to convert a char* to string.

2017-12-08 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 9 December 2017 at 05:55:21 UTC, Venkat wrote: I am trying out the DJni library (https://github.com/Monnoroch/DJni). For some reason std.conv.to!string doesn't want to convert a char* to a string.The lines below are taken from the log. I see that the last frame is at gc_qalloc. I

Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 4 May 2018 at 15:36:29 UTC, wjoe wrote: I have a class that I want to be able to register callbacks and I'd like to be able to register any callable - functions, delegates, lambdas, anything. Is there another way to do it besides converting those toDelegate, which states a bug

Re: Store any callable in an array

2018-05-04 Thread Neia Neutuladh via Digitalmars-d-learn
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? If it were @safe, the compiler would accept it. Looking at the code, I believe there are several casts that the compiler can't verify but are used safely.

Re: Error: cannot deduce function from argument types

2018-05-05 Thread Neia Neutuladh via Digitalmars-d-learn
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

Re: is ==

2018-05-18 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 19 May 2018 at 01:48:38 UTC, Jonathan M Davis wrote: Actually, that runtime function has existed since before TDPL came out in 2010. It even shows the implementation of the free function opEquals (which at the time was in object_.d rather than object.d). I'm not even sure that the

Re: is ==

2018-05-19 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 19 May 2018 at 04:30:24 UTC, Jonathan M Davis wrote: On Saturday, May 19, 2018 03:32:53 Neia Neutuladh via Digitalmars-d-learn wrote: > Of course, the most notable case where using == with null is > a terrible idea is dynamic arrays, and that's the case where > the

Re: Splitting up large dirty file

2018-05-17 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 15 May 2018 at 20:36:21 UTC, Dennis wrote: I have a file with two problems: - It's too big to fit in memory (apparently, I thought 1.5 Gb would fit but I get an out of memory error when using std.file.read) Memory mapping should work. That's in core.sys.posix.sys.mman for Posix

Re: is ==

2018-05-18 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 18 May 2018 at 23:53:12 UTC, IntegratedDimensions wrote: Why does D complain when using == to compare with null? Is there really any technical reason? if one just defines == null to is null then there should be no problem. It seems like a pedantic move by who ever implemented it and

Re: What is the point of nothrow?

2018-06-12 Thread Neia Neutuladh via Digitalmars-d-learn
On Wednesday, 13 June 2018 at 00:38:55 UTC, Jonathan M Davis wrote: It's possible to write programs that check and handle running out of memory, but most programs don't, and usually, if a program runs out of memory, it can't do anything about it and can't function properly at that point.

Re: What is the point of nothrow?

2018-06-12 Thread Neia Neutuladh via Digitalmars-d-learn
On Monday, 11 June 2018 at 00:47:27 UTC, Jonathan M Davis wrote: Why do you care about detecting code that can throw an Error? Errors are supposed to kill the program, not get caught. As such, why does it matter if it can throw an Error? Error is currently used for three different things: *

Re: scope(success) lowered to try-catch ?

2018-06-17 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 17 June 2018 at 10:58:29 UTC, Cauterite wrote: Is there a reason scope(success) needs to set up for exception handling? Or is this a bug / potential enhancement ? If you had no exception handling in place, you'd need to duplicate code in the output. For instance: void foo() {

Re: How do I break from loop when using parallel()?

2018-05-28 Thread Neia Neutuladh via Digitalmars-d-learn
On Monday, 28 May 2018 at 21:04:21 UTC, Dr.No wrote: import std.parallelism : parallel; foreach(t; parallel(arr)) { if(!doSomething(t)) { return false; }

Re: convert string to wchar[]

2018-05-26 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 26 May 2018 at 17:12:38 UTC, Dr.No wrote: What's D's way to do that? I need it to be mutable array of wchar because a Windows function requires that. Alternative to go down to using pointers, which would be something like: wchar[] w = new wchar[s.length]; memcpy(w.ptr, s.ptr,

Re: Remove closure allocation

2018-05-26 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 26 May 2018 at 15:00:40 UTC, Malte wrote: This compiles with DMD, however it returns random numbers instead of the value I passed in. Looks like a bug to me. Should that work or is there any other pattern I could use for that? Filed as

Re: determining if array element is null

2018-06-02 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 2 June 2018 at 18:10:38 UTC, eastanon wrote: Does D array implementation support an array of null values? int a[4] = null; But I ran into a type error while checking if a[i] is null foreach(i; 0..3){ if(i == null){ writeln("it is null"); } } } How do you set fixed size

Re: how to define infix function

2018-06-02 Thread Neia Neutuladh via Digitalmars-d-learn
On Saturday, 2 June 2018 at 21:44:39 UTC, greatsam4sure wrote: Sorry for the typo is it possible to define infix function in D 3.min(5)// 3: where min is a function, works in D 3 min 5 // does not work. thanks in advance This is a horrible abuse of D's operator overloading discovered by

Re: Blog post: using dynamic libraries in dub

2017-12-27 Thread Neia Neutuladh via Digitalmars-d-announce
On Monday, 25 December 2017 at 08:57:09 UTC, Jacob Carlborg wrote: If I knew exactly what would need to be done I would most likely have done it already :). Perhaps Martin that implemented the support on Linux or David that, I think, implemented it for LDC on macOS would be better suited for

Re: Blog post: using dynamic libraries in dub

2017-12-21 Thread Neia Neutuladh via Digitalmars-d-announce
On Tuesday, 19 December 2017 at 21:38:40 UTC, Mike Wey wrote: And for GtkD, that is why it would make sense to relay on the packages supplied by your distribution. And just list "gtkd-3" in the "libs" section. Avoiding the need for the workaround to build a shared version. That would be

Re: copy only reference rather duplicate a string in appender!string

2017-12-26 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 26 December 2017 at 15:37:12 UTC, Marc wrote: I do build a string by coping large parts of diffrent buffers, all those buffers live after the functional call, so rather than duplicate those string I'd like to copy only references to those parts rather duplicate every string. I

Re: Don't expect class destructors to be called at all by the GC

2017-12-21 Thread Neia Neutuladh via Digitalmars-d-learn
On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote: Even calling GC.collect directly did not guarantee the DB handle was closed at the right time. This may have been a bug in my code that left dangling references to it, or perhaps the array of Database handles was still scanned

Re: Dub project has both .sdl and .json files. Is this normal or did I do something wrong?

2018-08-04 Thread Neia Neutuladh via Digitalmars-d-learn
On Friday, 3 August 2018 at 19:41:32 UTC, Bastiaan Veelo wrote: But if you commit it, and a compiler deprecation causes a dependency in that pinned version to fail to compile, then your app won't compile either, even though your code itself does not suffer from the deprecation and even though

Re: Are properties mature enough?

2018-08-19 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 19 August 2018 at 18:32:17 UTC, QueenSvetlana wrote: In the D Style Guide, it says: Properties https://dlang.org/dstyle.html#properties Functions should be property functions whenever appropriate. In particular, getters and setters should generally be avoided in favor of property

Re: [OT] My State is Illegally Preventing Me From Voting In The Upcoming 2018 US Elections

2018-09-09 Thread Neia Neutuladh via Digitalmars-d-announce
On Sunday, 9 September 2018 at 09:34:31 UTC, Nick Sabalausky (Abscissa) wrote: 1. As most United States citizens are implicitly aware (though the government assumes NO responsibility to ensure citizens are aware of this), to vote in a United States of America election and have the vote legally

Re: Better diagnostics for null classes dereferencing

2018-07-10 Thread Neia Neutuladh via Digitalmars-d-learn
On Tuesday, 10 July 2018 at 22:53:25 UTC, kdevel wrote: extern (C) __gshared bool rt_trapExceptions; static this () { rt_trapExceptions = false; } This will catch exceptions raised in main and in static constructors that run after this one. However, if you put that code in

Re: Copy Constructor DIP and implementation

2018-09-11 Thread Neia Neutuladh via Digitalmars-d-announce
On Tuesday, 11 September 2018 at 15:22:55 UTC, rikki cattermole wrote: Here is a question (that I don't think has been asked) why not @copy? It's not wrong to call this an implicit constructor since it's called implicitly. It also means that, if we get implicit constructors in general, we

Re: static array of pointers to dynamic arrays of ints problem...

2018-04-22 Thread Neia Neutuladh via Digitalmars-d-learn
On Sunday, 22 April 2018 at 06:00:15 UTC, WhatMeForget wrote: foreach(i, elem; a) { int[] temp = new int[](5); .. a[i] = } You're taking the address of a local variable and persisting it beyond the variable's scope. This is not safe in general; compilers

Re: Beta 2.082.0

2018-10-17 Thread Neia Neutuladh via Digitalmars-d-announce
On Wednesday, 17 October 2018 at 14:02:20 UTC, Jesse Phillips wrote: Wait, why does each get a special bailout? Doesn't until full that role? `until` is lazy. We could have `doUntil` instead, which would be eager and would return a boolean indicating whether to continue. We could all write

Re: how to make '==' safe for classes?

2018-10-28 Thread Neia Neutuladh via Digitalmars-d-learn
On Sun, 28 Oct 2018 18:00:06 +, Stanislav Blinov wrote: > On Sunday, 28 October 2018 at 12:38:12 UTC, ikod wrote: > >> and object.opEquals(a,b) do not inherits safety from class C >> properties, and also I can't override it. > > Yep. Since Object is the base class and it defines opEquals

Re: Add D front-end, libphobos library, and D2 testsuite... to GCC

2018-10-28 Thread Neia Neutuladh via Digitalmars-d-announce
On Mon, 29 Oct 2018 03:43:49 +, Mike Parker wrote: > Congratulations are in order for Iain Buclaw. His efforts have been > rewarded in a big way. Last Friday, he got the greenlight to move > forward with submitting his changes into GCC: Awesome! What frontend version is this, out of

Dealing with raw types as attributes

2018-11-01 Thread Neia Neutuladh via Digitalmars-d-learn
The spec says that a user-defined attribute must be an expression, but DMD accepts a wide range of things as UDAs: struct Foo { string name = "unknown"; } @Foo int bar; `bar` has the *type* Foo as an attribute. It's not an *instance* of Foo. So if I try to look at the UDAs: static

Re: New Initiative for Donations

2018-10-26 Thread Neia Neutuladh via Digitalmars-d-announce
On Fri, 26 Oct 2018 06:19:29 +, Joakim wrote: > On Friday, 26 October 2018 at 05:47:05 UTC, Neia Neutuladh wrote: >> On Fri, 26 Oct 2018 02:38:08 +, Joakim wrote: >>> As with D, sometimes the new _is_ better, so perhaps you shouldn't >>> assume old is better either. >> >> There's no

Re: New Initiative for Donations

2018-10-27 Thread Neia Neutuladh via Digitalmars-d-announce
On Sat, 27 Oct 2018 10:54:30 +, Joakim wrote: > I see, so you want other taxpayers to bail you out for your mistakes, > interesting. One of the major points of having a government is to create these regulations that make it less likely for individuals to suffer from the actions of other

Re: Wed Oct 17 - Avoiding Code Smells by Walter Bright

2018-11-03 Thread Neia Neutuladh via Digitalmars-d-announce
On Sat, 03 Nov 2018 04:50:52 +, unprotected-entity wrote: > (q1) Why is it, that people who use D, object *so much* to the idea of > allowing (at the choice of the programmer) for a type to have it's own > private state *within* a module (so that its private state is respected > by other code

Re: Wed Oct 17 - Avoiding Code Smells by Walter Bright

2018-11-03 Thread Neia Neutuladh via Digitalmars-d-announce
On Sat, 03 Nov 2018 11:24:06 +, FooledDonor wrote: > And if the validity of a person's reasoning is a function of his way of > expressing them, well ... do not pose to software engineers at least If you want other people to do work for you, you need to convince them to do it. This is an open

Re: Wed Oct 17 - Avoiding Code Smells by Walter Bright

2018-11-04 Thread Neia Neutuladh via Digitalmars-d-announce
On Sun, 04 Nov 2018 11:36:39 +, FooledDonor wrote: > Can we argue about the problems arising from the potential introduction > of this feature? There are many potential features that wouldn't cause problems in isolation. Should we add all of them? Obviously not; the result would be a

<    1   2   3   4   >