Intelligent enums

2017-01-18 Thread Ignacious via Digitalmars-d-learn
I have the need to create an enum flag like structure to specify certain properties of a type easily. e.g., enum properties { Red, Blue, Hot, Sexy, Active, ... } But some properties will be mutually exclusive. I would like to contain all those rules for in the enum itself

Re: alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
On Thursday, 19 January 2017 at 02:51:03 UTC, rikki cattermole wrote: On 19/01/2017 3:35 PM, Ignacious wrote: On Thursday, 19 January 2017 at 02:25:44 UTC, Adam D. Ruppe wrote: On Thursday, 19 January 2017 at 02:15:04 UTC, rikki cattermole wrote: On 19/01/2017 3:08 PM, Ignacious wrote:

Re: alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
On Thursday, 19 January 2017 at 02:25:44 UTC, Adam D. Ruppe wrote: On Thursday, 19 January 2017 at 02:15:04 UTC, rikki cattermole wrote: On 19/01/2017 3:08 PM, Ignacious wrote: class Y { int y; alias y this; } class X { Y[] x; alias x this; } This should not fail: X x = new

alias not valid with ~

2017-01-18 Thread Ignacious via Digitalmars-d-learn
class Y { int y; alias y this; } class X { Y[] x; alias x this; } Yet X ~= 3; fails. 3 should be implicitly convertible to Y and then ~ should assign it. ?

writeln and ~

2017-01-14 Thread Ignacious via Digitalmars-d-learn
string concatenation is weird. We can do stuff like writeln(x); where x is, say a struct and it prints fine but when we do writeln(x ~ " ok"); it fails and requires us to convert x! Why can't string concatenation automatically try to convert the arguments? Is there any reason this is bad

Re: switch to member

2017-01-14 Thread Ignacious via Digitalmars-d-learn
On Saturday, 14 January 2017 at 11:32:10 UTC, Marc Schütz wrote: You can utilize a little-known `switch` syntax trick in combination with `foreach`. Because a `foreach` over tuples is unrolled at compile time, it works even if your fields don't have exactly the same types:

Re: switch to member

2017-01-14 Thread Ignacious via Digitalmars-d-learn
On Saturday, 14 January 2017 at 08:30:04 UTC, Meta wrote: On Saturday, 14 January 2017 at 05:29:49 UTC, Nicholas Wilson wrote: enum XX { X = Q.X.offsetof, Y = Q.Y.offsetof //ect. } and then *(cast(void*)(this) + x) = e; //if inside struct/class or *(cast(void*)(q) + x) = e; // if

switch to member

2017-01-13 Thread Ignacious via Digitalmars-d-learn
When doing common functionality for a switch, is there any way to optimize: switch(x) { case X: q.X = e; break; case Y: q.Y = e; break etc... } e is basically a value that, depending on the what kind(x), we assign it to a field in q. The name of

Re: GNU License warning:

2017-01-13 Thread Ignacious via Digitalmars-d
On Saturday, 14 January 2017 at 01:40:58 UTC, Chris M. wrote: On Friday, 13 January 2017 at 21:53:29 UTC, Ignacious wrote: On Friday, 13 January 2017 at 19:30:40 UTC, Chris Wright wrote: On Fri, 13 Jan 2017 15:19:57 +, Ignacious wrote: [...] LGPL is much more common, and LGPL isn't a

Re: [your code here]

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 20:40:32 UTC, mustafa wrote: dfdsfsd afdsaaf?

Re: Error deducing function

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 22:57:09 UTC, Adam D. Ruppe wrote: On Friday, 13 January 2017 at 22:22:12 UTC, Ignacious wrote: Like, which arguments actually pass and which ones fail, etc. Yes, I agree entirely. This would be a HUGE usability bonus, far better than most the other things

Error deducing function

2017-01-13 Thread Ignacious via Digitalmars-d
It would be EXTREMELY helpful if dmd would give a better result than main.d(30): Error: template main.Do cannot deduce function from argument types !(1, string, int)(2, "adf"), candidates are: main.d(6):main.Do(int x, string y, alias Q)(int z, string q) Like, which arguments

Re: GNU License warning:

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 19:30:40 UTC, Chris Wright wrote: On Fri, 13 Jan 2017 15:19:57 +, Ignacious wrote: Yes, but D uses mostly bindings and if any of those bindings use it then It effects the D program that uses it. Since many of the bindings are written in C/C++ one can expect

Re: GNU License warning:

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 15:56:40 UTC, Claude wrote: On Friday, 13 January 2017 at 15:15:14 UTC, Ignacious wrote: On Friday, 13 January 2017 at 12:01:22 UTC, bachmeier wrote: This is not the proper place to blog about software license preferences or to make unsubstantiated accusations

Re: GNU License warning:

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 06:37:42 UTC, Joakim wrote: On Friday, 13 January 2017 at 02:25:03 UTC, Ignacious wrote: On Friday, 13 January 2017 at 01:27:02 UTC, Chris Wright wrote: [...] That makes no sense(it's obvious by the definition of derivative so you are not saying anything

Re: GNU License warning:

2017-01-13 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 12:01:22 UTC, bachmeier wrote: On Friday, 13 January 2017 at 02:25:03 UTC, Ignacious wrote: [...] This is not the proper place to blog about software license preferences or to make unsubstantiated accusations against an organization you don't like. There are

Re: GNU License warning:

2017-01-12 Thread Ignacious via Digitalmars-d
On Friday, 13 January 2017 at 01:27:02 UTC, Chris Wright wrote: You offer an API and someone decides to build on it using the GPL -- no trouble there; your work is not a derivative of theirs, so their copyright cannot place restrictions on your work. That makes no sense(it's obvious by the

GNU License warning:

2017-01-12 Thread Ignacious via Digitalmars-d
https://www.gnu.org/licenses/gpl-3.0.en.html https://www.gnu.org/licenses/gpl-faq.html http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=Please%20Stop%20Using%20GNU%20Licenses http://gng.z505.com/cult.htm And, I should point out: "If I write a plug-in to use with a GPL-covered program, what

Re: Auto recursive function

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: Hi, I am currently trying to create a function makeMultidimensionalArray which allocates memory for a multidimensional array. It is very similar with [1], the difference being that it is uninitialized. Here is the code: auto

Re: Android Status

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 03:49:42 UTC, Joakim wrote: On Tuesday, 10 January 2017 at 18:48:17 UTC, Ignacious wrote: [...] It's probably not easier, and in any case, android-x86 won't be supported, largely because I don't have any working x86 devices. [...] Ok, well the x86 thing

Re: Auto recursive function

2017-01-11 Thread Ignacious via Digitalmars-d-learn
On Wednesday, 11 January 2017 at 19:23:10 UTC, Razvan Nitu wrote: Hi, I am currently trying to create a function makeMultidimensionalArray which allocates memory for a multidimensional array. It is very similar with [1], the difference being that it is uninitialized. Here is the code: auto

Re: Android Status

2017-01-10 Thread Ignacious via Digitalmars-d-learn
Well, I posed a reply but I guess it didn't get though ;/ I'm only suing android-x86 because I thought it would be easier to test/debug. My device is a cortex-arm7. Two questions I have: 1. In the command lines present there is a lot of use of `x86`. I used them to compile the hello world

Re: D Spam filter ridiculous/broke

2017-01-09 Thread Ignacious via Digitalmars-d
It would be nice, also, if when we click on a link in the forum that it takes us to the last page/message(Scrolls down to it) rather than forcing us to do this. Most of the time we don't want to have to either read through all the messages or click on the last page in the first place. If we

Re: D Spam filter ridiculous/broke

2017-01-09 Thread Ignacious via Digitalmars-d
On Tuesday, 10 January 2017 at 02:05:34 UTC, Adam D. Ruppe wrote: On Monday, 9 January 2017 at 23:08:49 UTC, Ignacious wrote: I try to post something, thinks it's spam, asks me to solve the captcha, then when I do, says I have to wait to post... which I do, then asks me to solve the captcha,

Re: D Spam filter ridiculous/broke

2017-01-09 Thread Ignacious via Digitalmars-d
On Monday, 9 January 2017 at 23:08:49 UTC, Ignacious wrote: I try to post something, thinks it's spam, asks me to solve the captcha, then when I do, says I have to wait to post... which I do, then asks me to solve the captcha, then wait to post, then asks me to solve the captcha, etc... ad

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
How difficult is it to build for x86/x64? Would be nice to be able to use something like http://www.android-x86.org/ as a test instead of an actual device. Does one simply have to use the proper ldc2/dmd and link in the correct libs? or is it more complex? Also, I'm a bit confused on how

D Spam filter ridiculous/broke

2017-01-09 Thread Ignacious via Digitalmars-d
I try to post something, thinks it's spam, asks me to solve the captcha, then when I do, says I have to wait to post... which I do, then asks me to solve the captcha, then wait to post, then asks me to solve the captcha, etc... ad infinitum.

Re: Android Status

2017-01-09 Thread Ignacious via Digitalmars-d-learn
On Monday, 9 January 2017 at 08:28:04 UTC, Joakim wrote: On Monday, 9 January 2017 at 00:40:35 UTC, Ignacious wrote: On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to

Re: It's alive! D building D building D, all on Android

2017-01-08 Thread Ignacious via Digitalmars-d-announce
Just reporting here that I was able to get a hello world working using windows and UoW. Some issues I had: 1. Had issues with outdated libraries. (ncurses, gcc, etc) 2. UoW Aniversary is based on Ubuntu 14, I was able to upgrade to 16.04 following online sources. Lots of snags but eventually

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
On Sunday, 8 January 2017 at 22:19:31 UTC, Joakim wrote: On Sunday, 8 January 2017 at 21:52:01 UTC, Ignacious wrote: Not sure what is going on, of course ;) So much BS just to do something that is suppose to be simple ;) test.d void main() { } here is test.o

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
On Sunday, 8 January 2017 at 20:34:21 UTC, Joakim wrote: On Sunday, 8 January 2017 at 19:58:06 UTC, Ignacious wrote: I suppose it will be easier to install a real ubuntu distro rather than relying on windows? All these issues seem to be related to outdated versions? Distributor ID: Ubuntu

Re: Android Status

2017-01-08 Thread Ignacious via Digitalmars-d-learn
Yeah, not a good idea to build from source yourself. Try the advice here, ie see if you can install a package with that library or just symlink to the older library if not: http://askubuntu.com/questions/771047/erlang-error-while-loading-shared-libraries-libncursesw-so-6 Well, the only

Re: D in MPLAB FOR PIC32

2017-01-06 Thread Ignacious via Digitalmars-d
On Friday, 6 January 2017 at 15:47:21 UTC, Igor Myronov wrote: Hi there comunity !!! Im an beginner in programming MCU ,but i'm already programming in D and also here im an absolute beginner. So ,my question is : Is possible to program in D micro*-controllers like the PIC32 ? Thanks to all.

String characters not extended

2017-01-02 Thread Ignacious via Digitalmars-d-learn
when one prints out a string with some extended(I guess it's unicode), writeln prints out the ascii versions that do not correspond to what they really are. e.g., an umlaut is printed out as 1/2 or something. how to get it to print the correct codes?

Re: Android Status

2017-01-02 Thread Ignacious via Digitalmars-d-learn
On Monday, 2 January 2017 at 03:08:10 UTC, Joakim wrote: On Sunday, 1 January 2017 at 09:34:24 UTC, Ignacious wrote: Can you try sudo apt-get install libconfig9 I don't know if that will install something different, but it's the command I see others using online. Otherwise, check if the

Re: Android Status

2017-01-01 Thread Ignacious via Digitalmars-d-learn
Can you try sudo apt-get install libconfig9 I don't know if that will install something different, but it's the command I see others using online. Otherwise, check if the libconfig++9 package you installed included libconfig.so.9, which is what ldc is linked against. If not, install the

Re: Reducing visual clutter.

2016-12-31 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 12:31:07 UTC, Nicholas Wilson wrote: On Saturday, 31 December 2016 at 11:39:39 UTC, Nicholas Wilson wrote: [...] Oh and `kernel` could be a template function that would need its args forwarded to it. Alias it away using a wrapper?

Re: Android Status

2016-12-31 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 06:33:10 UTC, Ignacious wrote: On Saturday, 31 December 2016 at 05:52:00 UTC, Ignacious wrote: On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: [...] Is there any way to get a package that works for windows? While the steps don't seem too

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Saturday, 31 December 2016 at 05:52:00 UTC, Ignacious wrote: On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: [...] Is there any way to get a package that works for windows? While the steps don't seem too difficult to do, things never go well for me(something always breaks...

Re: Android Status

2016-12-30 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Re: Android Status

2016-12-29 Thread Ignacious via Digitalmars-d-learn
On Thursday, 29 December 2016 at 10:14:53 UTC, Joakim wrote: On Wednesday, 28 December 2016 at 23:33:57 UTC, Ignacious wrote: What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving

Android Status

2016-12-28 Thread Ignacious via Digitalmars-d-learn
What is the current status for building android apps in D? I would like to create simple graphic based apps but don't wanna get bogged down in trying to get car moving without any wheels.

Re: It's a Christmas miracle: main no longer runs after unittests

2016-12-25 Thread Ignacious via Digitalmars-d
On Sunday, 25 December 2016 at 09:44:07 UTC, Doug wrote: On Sunday, 25 December 2016 at 07:30:39 UTC, Ignacious wrote: Given that Christmas is one of the hugest fabrications in human history, I find this very difficult to believe! (or simply to cover all bases, quite easy to believe) xmas is

Re: It's a Christmas miracle: main no longer runs after unittests

2016-12-24 Thread Ignacious via Digitalmars-d
On Saturday, 24 December 2016 at 22:14:08 UTC, Andrei Alexandrescu wrote: https://github.com/dlang/druntime/pull/1724 Ho-ho-ho! Andrei Given that Christmas is one of the hugest fabrications in human history, I find this very difficult to believe! (or simply to cover all bases, quite easy

Compiler concept

2016-12-12 Thread Ignacious via Digitalmars-d
Would it be difficult to implement the following, or something with similar capabilities, as a patch to dmd? Create a compiler that lets one use actual code as templates. e.g., a text block of a function can be referenced by in the code using a "dom" to modify that code similar to how we can