Re: arrays in DMD V2

2014-04-18 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 19 April 2014 at 00:27:32 UTC, steven kladitis wrote: import std.stdio; void main() { inta0[]; inta1[][]; string a2[][]; string a3[][string]; string a4[][string][string]; //string a4[string][string][string]; is this the same as above int

Re: arrays in DMD V2

2014-04-19 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 19 April 2014 at 03:51:02 UTC, steven kladitis wrote: import std.stdio; void main() { inta0[]; inta1[][]; string a2[][]; string a3[][string]; string a4[][string][string]; //string a4[string][string][string]; is this the same as above int

Re: arrays in DMD V2

2014-04-19 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 19 April 2014 at 16:14:45 UTC, steven kladitis wrote: void main() { //inta0[]; int[] a0; //inta1[][]; int[][] a1; //string a2[][]; string[][] a2; //string a3[][string]; string[string] a3; // string[][string] a3; // possibly should be above for a3 //string

Re: Auto return type inference issue?

2014-04-22 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 22 April 2014 at 07:54:34 UTC, Matthew Dudley wrote: Here's the gist of what I'm trying to do. https://gist.github.com/pontifechs/11169069 I'm getting an error I don't understand: tinker.d(42): Error: mismatched function return type inference of tinker.B and tinker.A

Re: Auto return type inference issue?

2014-04-23 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 23 April 2014 at 23:05:39 UTC, Matthew Dudley wrote: tuple in this case would be the member variable of type T (from T...) So wouldn't elem be the actual object, and not the type? The effective lowering I was hoping for would be something like this if (names[0] == one)

Re: Pointer to template types?

2014-04-28 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 28 April 2014 at 10:40:49 UTC, Chris wrote: Person!(string) *pptr; Just wanted to point out, the above is C style and not recommended. Person!(string)* pptr, pptr2, pptr3; In D the pointer is part of the type not the variable (all three are pointers, unlike C where only the

Re: SQLite3

2014-05-08 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 7 May 2014 at 06:21:10 UTC, Jack wrote: First off a Disclaimer: I'm a noob and still learning. Please don't bash me like some forums. Now to the questions: I'm searching for a quick and easy way to integrate SQLite3 in my application. I came across the etc.c.sqlite3 and the

Re: Recommendation on option parsing

2014-05-13 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 17:05:15 UTC, Chris Piker wrote: I tried that, but you're using private members of std.getopt (which of course is okay for the way you intended the code to be used) so I stopped pursuing this solution. Not sure why he had you break up the file. It should be as simple

Re: How to assign a delegate to a var ?

2014-06-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 15:14:06 UTC, bioinfornatics wrote: without using a delegate, with a function that will not work as (int a) = a == 42 is a delegate no ? D will decide the type based on if context is needed. If you look at the output you had: , __ctmp1474).this(function (int

Re: why it said no identifier for declarator …

2014-06-03 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 3 June 2014 at 22:10:06 UTC, bioinfornatics wrote: I do not see why it fail in debug output we see that tuple have a field with given name. Your generated output (short and formatted) alias TL = Tuple!(int,x, bool function( const ref string ), xStartsWith , bool function(

Re: why it said no identifier for declarator …

2014-06-04 Thread Jesse Phillips via Digitalmars-d-learn
I take it the output looks something like this: struct S { int a; } S s; s.a = 3; void main() { } Hope this clears up this next problem. Module scope doesn't get to utilize a variable, it can only initialize at compile-time.

Re: Create const regex?

2014-06-07 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 6 June 2014 at 12:08:40 UTC, Rikki Cattermole wrote: In none of your examples you have not defined the type of the variables. However you are giving it an access modifier. I assume you are wanting auto D does not require providing a type if const/immutable is use. I think at this

Re: When is a slice not a slice?

2014-06-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 5 June 2014 at 19:45:59 UTC, Alix Pexton wrote: unittest { auto a = DataAndView(1); assert (sameTail(a.data, a.view)); enum b = DataAndView(1); assert (!sameTail(b.data, b.view)); } Just a request of presentation. Please make expected assertions:

Re: How to I call D code from C# Project?

2014-06-18 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 20:55:09 UTC, GoD wrote: Hi. I want use my D code in C# How can I do this? My plan was to use COM. I've not actually implemented such communication. Juno provides some items: https://github.com/JesseKPhillips/Juno-Windows-Class-Library/ But I haven't done

Re: How to I call D code from C# Project?

2014-06-18 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 18 June 2014 at 23:41:43 UTC, GoD wrote: @Jesse How to use in C# projects? You'll have to access it through a COM interface on the C# side. http://msdn.microsoft.com/en-us/library/aa645736%28v=vs.71%29.aspx If you haven't done work in COM before its a lot of new things to

Re: rehabilitating Juno

2014-06-19 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 19 June 2014 at 13:06:15 UTC, Jason King wrote: This is specifically for Jesse K Phillips, Jesse, It appears we're both interested in Juno. You lack time and I lack D experience. What could a D clown do for your juno repository to get it functional again. The last time I

Re: rehabilitating Juno

2014-06-20 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 19 June 2014 at 15:24:41 UTC, Jesse Phillips wrote: Once I get some examples compiling again in 32bit, it should be easier for you to play around with COM in D. I've pushed changes which get the library building and examples working. Let me know if there is any other direction I

Re: rehabilitating Juno

2014-06-21 Thread Jesse Phillips via Digitalmars-d-learn
On Saturday, 21 June 2014 at 10:26:57 UTC, simendsjo wrote: This is great. I used Juno back in 2007 for working with Excel, and it worked great. Nice to see the library getting an update for D2. I remember seeing some slides on another COM library for D2 a while ago. Was that effort ever

Re: File needs to be closed on Windows but not on Posix, bug?

2014-07-07 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 July 2014 at 12:00:48 UTC, Regan Heath wrote: But! I agree with Adam, leave it as a thin wrapper. Being a windows programmer by trade I would expect the remove to fail, I would not expect all my files to be opened with delete sharing enabled by default. R And I believe

Re: File needs to be closed on Windows but not on Posix, bug?

2014-07-08 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 July 2014 at 16:02:33 UTC, Kagamin wrote: On Monday, 7 July 2014 at 14:25:54 UTC, Regan Heath wrote: If I had to guess, I would say it would still be possible to access the file. It's documented so. I guess, linux implements file deletion with delete-on-close feature too, if it

Re: It is a bug?

2014-07-30 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 30 July 2014 at 07:08:17 UTC, Kozzi11 wrote: #main.d: import m.f; class A { //class main.A member m is not accessible //mixin(t!(typeof(this), m)); void m() {}; //here is ok //mixin(t!(typeof(this), m)); } The compiler is trying to construct type A. The first

Re: Does D provide automatic dereferencing for accessing members through pointers?

2014-08-27 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby wrote: I've taken a look in the std lib and the second form is used a lot. Why don't you need to dereference the pointer 'foo' to reach its member 'bar'? Walter didn't want foo-bar so we have foo.bar

Re: Beginner ?. Why does D suggest to learn java

2014-10-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 16 October 2014 at 22:26:51 UTC, RBfromME wrote: I'm a newbie to programming and have been looking into the D lang as a general purposing language to learn, yet the D overview indicates that java would be a better language to learn for your first programming language. Why? Looks

Re: Casting char[] ranges to string can lead to unexpected behavior

2014-10-30 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 31 October 2014 at 02:04:00 UTC, Domingo wrote: I spent two days to find a nasty aleatory problem due to a string been assigned a range from a char[] array. This issue on vibe.d detail it a bit more: https://github.com/rejectedsoftware/vibe.d/issues/889 I'm putting it here to

Re: Template constraint: T is a value type

2014-10-30 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 29 October 2014 at 11:49:59 UTC, John Colvin wrote: On Wednesday, 29 October 2014 at 10:01:18 UTC, Gareth Foster wrote: Hi there, I'm looking to write a function template that operates only on value types. Basically I'm looking for an equivalent of where T: struct from C#

Re: insertInPlace differences between compilers

2014-11-11 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 20:53:51 UTC, John McFarlane wrote: I'm trying to write a struct template that uses `insertInPlace`. However, it doesn't work with certain template type / compiler combinations. Consider the following: import std.range; struct S { const int c; } S[]

Re: insertInPlace differences between compilers

2014-11-12 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 12 November 2014 at 19:25:49 UTC, John McFarlane wrote: That makes sense. In the case that `c` is a class, do you think I'd have any luck if I made it immutable? The quick answer is that it doesn't help. DMD still doesn't like me using insertInPlace. This is a little disappointing

Re: passing duck-typed objects and retaining full type information

2014-11-12 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 11 November 2014 at 19:23:39 UTC, Adam Taylor wrote: Now what i want to do is pass some such container object to an interface function: interface MyInterface { void filterCollisions(S)(S collisionCandidates) if(canRemoveFromContainer!S) } You can't. This is one of the major

Re: Why the DMD Backend?

2014-12-03 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 28 November 2014 at 20:14:07 UTC, LeakingAntonovPlane wrote: DDMD, bootstraping. LDC and GDC are not written in D. Pretty sure that DDMD project is not a translation of the backend and is only the shared front end source code.

What is @return?

2015-01-28 Thread Jesse Phillips via Digitalmars-d-learn
A recent discussion over in digitalmars.D http://forum.dlang.org/post/rtwbtxigfeupvykpb...@forum.dlang.org talks about accepting @return... Here is an example from the PR: https://github.com/D-Programming-Language/dmd/compare/366422338ece...6b86b12f79e8 struct At { @property auto info() @safe

Re: What is @return?

2015-01-29 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 29 January 2015 at 05:02:58 UTC, ketmar wrote: http://wiki.dlang.org/DIP25 this is a very recent thing, it wasn't coded when 2.066 was released. Thanks, I like it.

Re: Import paths do not work

2015-01-29 Thread Jesse Phillips via Digitalmars-d-learn
Let me try to explain the compilation process which may help you to understand where your problem lies. * Build system * Maintain program/library dependencies * Execute commands resulting in a usable program/library * Compiler * Lexical Analysis * Parsing

Re: For those ready to take the challenge

2015-01-09 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 9 January 2015 at 13:50:29 UTC, eles wrote: https://codegolf.stackexchange.com/questions/44278/debunking-stroustrups-debunking-of-the-myth-c-is-for-large-complicated-pro Link to answer in D: http://codegolf.stackexchange.com/a/44417/13362

Re: Int to float?

2015-03-05 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 5 March 2015 at 20:06:55 UTC, Taylor Hillegeist wrote: On Thursday, 5 March 2015 at 20:03:09 UTC, Benjamin Thaut wrote: Am 05.03.2015 um 21:00 schrieb Taylor Hillegeist: How to I cast a Int to float without changing its binary representation? int someValue = 5; float sameBinary

Re: Getting associative array value by reference

2015-03-31 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 1 April 2015 at 03:11:58 UTC, Mark Isaacson wrote: I'm presently trying to create the value of a key in an associative array if it does not exist, and then maintain a reference/pointer to the value. This is what I came up with, but it seems really crufty and I feel that there

Re: The site engine written in D

2015-03-02 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 2 March 2015 at 08:49:04 UTC, Kagamin wrote: https://github.com/rejectedsoftware/vibelog https://github.com/rejectedsoftware/vibed.org - site itself https://github.com/rikkimax/Cmsed - CMS in D Or does he mean: DFeed was written mostly by Vladimir “CyberShadow” Panteleev. Portions

Re: No line numbers in compiler error messages

2015-04-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 April 2015 at 17:20:12 UTC, John Nixon wrote: I am using dmd v2.067.0 on Mac OSX with Terminal and I found the lack of line numbers surprising. Is there something simple I am doing wrong? Do any of the switches on the command line do this? BTW I only found out about D a couple

Re: Convert hex to binary

2015-04-24 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 24 April 2015 at 18:14:07 UTC, nrgyzer wrote: Hi, I'm looking for a function that converts my hex-string to a binary representation. In Python I write the following: myHex = 123456789ABCDEF myBin = myHex.decode('hex') But how to do the same in D? Is there any function? Thanks

Re: randomUUID for runtime / how to generate UUIDs in runtime

2015-04-17 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 17 April 2015 at 14:05:26 UTC, Ozan Süel wrote: Why I'm asking: I want to create class instances with an unique id as default. But now that great idea seems to be a death end. Sounds like your code is something like: class foo { auto myid = randomUUID(); } The compiler

Re: Erroneous auto can only be used for template function parameters?

2015-06-22 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 21 June 2015 at 02:37:59 UTC, Yuxuan Shui wrote: On Sunday, 21 June 2015 at 01:26:51 UTC, Adam D. Ruppe wrote: On Saturday, 20 June 2015 at 01:50:11 UTC, Yuxuan Shui wrote: auto ref R) is indeed a template function, so I don't understand. But R is not a parameter on the function

Re: best way to interface D code to Excel

2015-06-19 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 17 June 2015 at 18:35:36 UTC, Laeeth Isharc wrote: Hi. I know D has support for COM - not sure of its status. And there was a Microsoft chap who posted here a couple of years back - wonderful templated code that made it easy to write this kind of thing. Unfortunately he

Re: Windows Universal/Store apps support

2015-05-29 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 28 May 2015 at 15:57:42 UTC, Olivier Prince wrote: I searched the forum to find if there is some support for new Windows development technologies and I didn't find anything related (except some rants about WinRT 3 years ago). - Is there any support in D or phobos for developping

Re: Pure delegate not quite pure?

2015-06-30 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 30 June 2015 at 22:23:40 UTC, Tofu Ninja wrote: On Tuesday, 30 June 2015 at 22:05:43 UTC, Steven Schveighoffer wrote: Have you tried placing const on the function signature? i.e.: pure int delegate() const d = () const {... That's how you'd do it (I think, didn't test) if the

Re: Are Lua tables possible to do with D?

2015-07-16 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 16 July 2015 at 06:48:12 UTC, Robert M. Münch wrote: Hi, do you think it's possible to implemented something like Lua Tables (a hashed heterogeneous associative array) in D? I know that Lua is dynamic and interpreted, hence it's a lot simpler to do than with a compiled language

Re: Delayed const variable initialization

2015-07-13 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 13 July 2015 at 14:41:36 UTC, Steven Schveighoffer wrote: You can also do a temporary lambda that you call immediately, but I'm not 100% sure of the syntax. Someone will chime in with the answer :) -Steve Syntax is easy: void main() { bool condition; const x = {

Re: Replacement of std.stream

2015-07-20 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 19 July 2015 at 17:34:27 UTC, Charles Hixson wrote: The documentation of std.mmfile.MmFile makes it an unacceptable replacement for std.stream. I can't even tell if it's features are missing, or just unintelligible. It rather looks as if you need to have enough RAM to hold the

Re: Coercing ranges to the same type

2015-07-07 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 6 July 2015 at 19:46:51 UTC, Matt Kline wrote: Say I'm trying to expand an array of file and directory paths (such as ones given as command line args) into a range of file paths I can iterate over. A simplified example might be: auto getEntries(string[] paths, bool recursive) {

Re: Are there any Phobos functions to check file permissions on Windows and Posix?

2015-09-08 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 7 September 2015 at 15:48:56 UTC, BBasile wrote: On Sunday, 6 September 2015 at 23:05:29 UTC, Jonathan M Davis wrote: [...] which makes treating some of this stuff in a cross-platform fashion quite difficult. And even more with ACLs that it could be: Not to mention, Windows locks

Re: Why are static arrays not ranges?

2015-09-21 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 21 September 2015 at 20:33:10 UTC, Jack Stouffer wrote: import std.range; void main() { int[6] a = [1, 2, 3, 4, 5, 6]; pragma(msg, isInputRange!(typeof(a))); pragma(msg, isForwardRange!(typeof(a))); pragma(msg, isRandomAccessRange!(typeof(a))); } $ dmd -run test.d

Re: Must ranges have value semantics?

2015-12-15 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 15 December 2015 at 17:36:52 UTC, Chris Wright wrote: I noticed that some methods in Phobos will have very different behavior with forward ranges that have reference semantics and those that have value semantics. Example: auto range = getSomeRange(); auto count =

Re: Communicating with external processes in D

2015-11-24 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 23 November 2015 at 20:02:16 UTC, Cameron Reid wrote: I'm rather new to D, so apologies if this is a silly question: I'd like to be able to fork a number of instances of a process, write to their stdins and read from their stdouts in parallel. That is, I want to write some data to

Re: Accessing COM Objects

2016-06-15 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 13 June 2016 at 01:22:33 UTC, Incognito wrote: I've been reading over D's com and can't find anything useful. It seems there are different ways: http://www.lunesu.com/uploads/ModernCOMProgramminginD.pdf which is of no help and requires an idl file, which I don't have. Then

Re: Calling C++ code with pointer** argument

2016-06-01 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 1 June 2016 at 16:16:26 UTC, Kagamin wrote: Can you declare it as const char*const* one the C++ side? Just to state the problem clearly, D's const is transitive, C++ it is not. C linkage doesn't care about const, so you can specify it however you want. In C++ the const is

Re: Bug in csv or byLine ?

2016-01-10 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 10 January 2016 at 18:09:23 UTC, Tobi G. wrote: The bug has been fixed... Do you have a link for the fix? Is there a BugZilla entry?

Re: Why we cannot use string in mixins?

2016-02-29 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 28 February 2016 at 03:08:14 UTC, mahdi wrote: Thanks. So the author was plain wrong about using enums instead of strings. The misconception is due to assuming we can use `string` variables at compile time but we cannot (as they are run-time data). Not exactly either.

Re: Speed of csvReader

2016-01-21 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 21 January 2016 at 21:24:49 UTC, H. S. Teoh wrote: Of course, running without GC collection is not a fair comparison with std.csv, so I added an option to my benchmark program to disable the GC for std.csv as well. While the result was slightly faster, it was still much slower

Re: Speed of csvReader

2016-01-21 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 21 January 2016 at 23:03:23 UTC, cym13 wrote: but in that case external quotes aren't required: number,name,price,comment 1,Twilight,150,good friend 2,Fluttershy,142,gentle 3,Pinkie Pie,169,He said ""oh my gosh"" std.csv will reject this. If validation is turned

Re: Speed of csvReader

2016-01-21 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 22 January 2016 at 00:56:02 UTC, cym13 wrote: Great! Sorry for the separator thing, I didn't read your code carefully. You still lack some things like comments and surely more things that I don't know about but it's getting there. I didn't think you'd go through the trouble of

Re: Improving CSV parsing performance, Episode 2 (Was: Re: Speed of csvReader)

2016-01-23 Thread Jesse Phillips via Digitalmars-d-learn
On Sunday, 24 January 2016 at 01:57:11 UTC, H. S. Teoh wrote: - Ummm... make it ready for integration with std.csv maybe? ;-) T My suggestion is to take the unittests used in std.csv and try to get your code working with them. As fastcsv limitations would prevent replacing the std.csv

Re: Improving CSV parsing performance, Episode 2 (Was: Re: Speed of csvReader)

2016-01-26 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 26 January 2016 at 06:27:49 UTC, H. S. Teoh wrote: On Sun, Jan 24, 2016 at 06:07:41AM +, Jesse Phillips via Digitalmars-d-learn wrote: [...] My suggestion is to take the unittests used in std.csv and try to get your code working with them. As fastcsv limitations would prevent

Re: Speed of csvReader

2016-01-22 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 22 January 2016 at 01:36:40 UTC, cym13 wrote: On Friday, 22 January 2016 at 01:27:13 UTC, H. S. Teoh wrote: And now that you mention this, RFC-4180 does not allow doubled quotes in an unquoted field. I'll take that out of the code (it improves performance :-D). Right, re-reading

Re: Speed of csvReader

2016-01-21 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 21 January 2016 at 09:39:30 UTC, data pulverizer wrote: R takes about half as long to read the file. Both read the data in the "equivalent" type format. Am I doing something incorrect here? CsvReader hasn't been compared and optimized from other CSV readers. It does have

Re: Updating D-based apps without recompiling it

2016-03-23 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 12:21:33 UTC, Ozan wrote: Hi Enterprise applications in productive environments requires smooth updating mechanisms without recompiling or reinstalling. It's not possible to stop an enterprise application, then run "dub --reforce" and wait until finish. Mostly

Re: Updating D-based apps without recompiling it

2016-03-24 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 23 March 2016 at 17:29:50 UTC, Jacob Carlborg wrote: On 2016-03-23 18:15, Jesse Phillips wrote: Do you have an example of this being done in any other language? In Erlang it's possible to hot swap code. I'm not sure how it works though. But if we're talking servers, the

Re: DWT Cloning / Build fails

2016-04-13 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 13 April 2016 at 09:01:47 UTC, Chris wrote: On Tuesday, 12 April 2016 at 19:20:44 UTC, Jacob Carlborg wrote: The error messages are below. If I do it step by step (without --recursive) and then "git submodule update --init", I get more or less the same error: Cloning into

Re: C header file: tagged enumerations

2016-04-26 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 23:33:08 UTC, Stefan Koch wrote: On Tuesday, 26 April 2016 at 22:57:36 UTC, Jesse Phillips wrote: Windows tends to have these in their header files, what is the best way to translate them to D? [...] eunm win32msi = mixin(_WIN32_MSI); static if (win32msi >=

C header file: tagged enumerations

2016-04-26 Thread Jesse Phillips via Digitalmars-d-learn
Windows tends to have these in their header files, what is the best way to translate them to D? https://msdn.microsoft.com/en-us/library/whbyts4t.aspx Example below. In general a named enum is close enough to the same thing, but this example has additional enumerations added based on the

Re: C header file: tagged enumerations

2016-04-28 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 27 April 2016 at 16:04:13 UTC, Steven Schveighoffer wrote: BTW, this enumeration looks terrible. I would flag this as blocking if it were a code review, even in C++. -Steve Yeah, I didn't even consider that different versions have different enum values; that is going to be a

Re: C header file: tagged enumerations

2016-04-28 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 28 April 2016 at 17:40:23 UTC, Jesse Phillips wrote: enum tagINSTALLMESSAGE { // 12 others ... INSTALLMESSAGE_INITIALIZE , INSTALLMESSAGE_TERMINATE , INSTALLMESSAGE_SHOWDIALOG , [greaterThan(500)] INSTALLMESSAGE_PERFORMANCE,

Re: C header file: tagged enumerations

2016-04-28 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 28 April 2016 at 08:54:45 UTC, Kagamin wrote: enum { // 12 others ... INSTALLMESSAGE_INITIALIZE , INSTALLMESSAGE_TERMINATE , INSTALLMESSAGE_SHOWDIALOG } static if(_WIN32_MSI >= 500) enum INSTALLMESSAGE_PERFORMANCE=15; static if(_WIN32_MSI >= 400)

Re: C++ interface vs D and com

2016-07-13 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 13 July 2016 at 02:41:22 UTC, Adam Sansier wrote: If you can convince me to try it out, I might... but doing com isn't my primary goal here and I seem to have finished up what I was trying to achieve(my use case is probably relatively simple though). Last thing I want to do is

Re: C++ interface vs D and com

2016-07-12 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote: So, com throughs me a interface ptr and I need to map it to an interface. When I do, I get an access violation. I have an (com) ptr and an interface. How do I link them up so I can call the functions? I marked the interface

Re: adding toString to struct

2016-07-12 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 12 July 2016 at 05:16:30 UTC, Adam Sansier wrote: windows libs have a lot of structs and it would be nice to have the ability to convert them to a string to see them in the debugger(e.g., CLSID). Is there a way to do this? I've tried to pull out the code from the libs but it if a

Re: shuffle a character array

2016-07-20 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 20 July 2016 at 16:03:27 UTC, pineapple wrote: On Wednesday, 20 July 2016 at 13:33:34 UTC, Mike Parker wrote: There is no auto-decoding going on here, as char[] and wchar[] are rejected outright since they are not considered random access ranges. They are considered random

Re: string mixin and alias

2016-07-29 Thread Jesse Phillips via Digitalmars-d-learn
D won't let you hide the mixin, the keyword is there specifically to indicate code is being injected in that location. This isn't what you are looking for, but you can do something like this: - string generateCode(string s){return "";} void main() { enum s =

Re: string mixin and alias

2016-07-29 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 29 July 2016 at 18:34:56 UTC, Jesse Phillips wrote: Here the generateCode() is mixed in to the context of foo(), which is fine if your code is performing actions but is no good if you're creating declarations that you want to use in the context of main(). Here is a fully

Re: D package for optimizing/compressing images

2017-01-27 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 27 January 2017 at 11:03:15 UTC, aberba wrote: Are there any dub package for compressing images uploaded through web forms? Cropping/resizing may also come in handy. I want one for a vibe.d project. I don't know of any D projects. If I were doing this I'd be running the vibe.d

Re: Quine using strings?

2017-01-17 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 16 January 2017 at 13:11:38 UTC, pineapple wrote: On Monday, 16 January 2017 at 09:33:23 UTC, Nestor wrote: PS. Isn't this approach considered "cheating" in quines? ;) I'm afraid so - while the empty program has been technically accepted as being a quine (e.g.

Re: Creating an array of user-defined structs

2016-08-22 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 22 August 2016 at 07:00:23 UTC, brian wrote: On Monday, 22 August 2016 at 06:19:00 UTC, Mike Parker wrote: Terminology wise, we distinguish between associative arrays (AA) and arrays. The former should never simply be called 'array', otherwise people will assume you are referring to

Re: Why some function are class-less?

2016-11-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:54:23 UTC, Suliman wrote: Ok, but when the logger class may be more helpful that function usage? You'd use the logger class when you need to make customizations or have multiple logging schemes. I'd expect Vibe.d allows you to override the global logging

Re: Why some function are class-less?

2016-11-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 17 November 2016 at 18:40:12 UTC, Suliman wrote: For example I need to write all logs to file. I see this function, that seem set some global file name. "setLogFileSets a log file for disk file logging." But would it name accessible from anywhere or it would be visible

Re: Why is three safety levels need in D?

2016-11-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 17 November 2016 at 17:18:27 UTC, Nordlöw wrote: Why does D need both `@safe`, `@trusted` and `@system` when Rust seems to get by with only safe (default) and `unsafe`? https://dlang.org/spec/memory-safe-d.html http://dlang.org/safed.html D makes it illegal for @safe code to

Re: bug in foreach continue

2017-03-22 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 17 March 2017 at 19:05:20 UTC, H. S. Teoh wrote: There are actually (at least) TWO distinct phases of compilation that are conventionally labelled "compile time": 1) Template expansion / AST manipulation, and: 2) CTFE (compile-time function evaluation). This was an awesome

Re: How to use C code in D

2017-03-24 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 23 March 2017 at 18:10:20 UTC, Dillen Meijboom wrote: Hi there, I'm learning D for a while because it's really easy to use C-code in D. The problem is that I don't really get how to deal with the data structures defined in C in D. D makes it easy to utilize C code, but there is

Re: ctRegex with variable?

2017-04-13 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 12 April 2017 at 21:25:40 UTC, Jethro wrote: Can regex's have variables in them? I'd like to create a ctRegex but match on runtime strings that are known at runtime. e.g., auto c = ctRegex~("x{var}") As mentioned by Ali, benchmark for your use case. If var has common values

Generating switch at Compile Time

2017-04-13 Thread Jesse Phillips via Digitalmars-d-learn
I realize that this is likely really pushing the compile time generation but a recent change to the switch statement[1] is surfacing because of this usage. uninitswitch2.d(13): Deprecation: 'switch' skips declaration of variable uninits witch2.main.li at uninitswitch2.d(14)

Re: Generating switch at Compile Time

2017-04-17 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 13 April 2017 at 21:33:28 UTC, ag0aep6g wrote: That's not a static foreach. It's a normal run-time foreach. The switch jumps into the loop body without the loop head ever executing. The compiler is correct when it says that initialization of li is being skipped. Good good. I did

Re: It makes me sick!

2017-07-27 Thread Jesse Phillips via Digitalmars-d-learn
On Thursday, 27 July 2017 at 03:34:19 UTC, FoxyBrown wrote: Knowing that every time I upgrade to the latest "official" D compiler I run in to trouble: I recompiled gtkD with the new compiler, same result. My code was working before the upgrade just fine and I did not change anything. I've

Re: Processing a gzipped csv-file by line-by-line

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 22:20:52 UTC, Nordlöw wrote: What's fastest way to on-the-fly-decompress and process a gzipped csv-fil line by line? Is it possible to combine http://dlang.org/phobos/std_zlib.html with some stream variant of File(path).byLineFast ? You can't really parse a

Re: Access specifiers and visibility

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 13:29:40 UTC, Andrew Edwards wrote: On Wednesday, 10 May 2017 at 13:13:46 UTC, Jesse Phillips wrote: On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote: Attempting to update a git repo to current D, I encounter the following deprecation messages:

Re: Access specifiers and visibility

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 10 May 2017 at 01:42:47 UTC, Andrew Edwards wrote: Attempting to update a git repo to current D, I encounter the following deprecation messages: src/glwtf/signals.d-mixin-256(256,2): Deprecation: glwtf.input.BaseGLFWEventHandler._on_key_down is not visible from module

Re: Error writing file a *.obj

2017-05-10 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 9 May 2017 at 02:33:06 UTC, dummy wrote: On Monday, 8 May 2017 at 12:29:27 UTC, bachmeier wrote: On Monday, 8 May 2017 at 11:56:10 UTC, dummy wrote: When i build some application with dub, i got this error: I'm not a Dub user, but it has its own forum, so you might want to try

Re: Implementing interfaces using alias this

2017-06-15 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 14 June 2017 at 09:34:27 UTC, Balagopal Komarath wrote: Why doesn't this work? The Test!Duck type has a void quack() method but the compiler says it is not implemented. You question was answered, but you can do this: -- interface IDuck { void

Re: Implementing interfaces using alias this

2017-06-16 Thread Jesse Phillips via Digitalmars-d-learn
On Friday, 16 June 2017 at 08:34:21 UTC, Biotronic wrote: On Thursday, 15 June 2017 at 18:49:58 UTC, Jesse Phillips wrote: wrap!IDuck Ah, so it does exist in Phobos. I thought it should be there, but didn't find it. Thanks! -- Biotronic Yeah, when Andrei introduced the wrap function I

Re: Can assumeSafeAppend() grab more and more capacity?

2017-06-06 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 5 June 2017 at 23:17:46 UTC, Ali Çehreli wrote: auto a = [ 1, 2, 3, 4 ]; auto b = a; Both of those slices have non-zero capacity yet one of them will be the lucky one to grab it. Such semantic issues make me unhappy. :-/ Ali You have to remember that slices don't own

Re: Little app using gtkD, how to make it well?

2017-09-11 Thread Jesse Phillips via Digitalmars-d-learn
On Monday, 11 September 2017 at 20:19:28 UTC, Romain wrote: Hello, I started an application using gtkD and libusb-d. I would love to get some hints about how to make good use of D since I'm a java developper and maybe use too much of it in D code or doing wrong things. The program will

Re: Ranges seem awkward to work with

2017-09-11 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 12 September 2017 at 01:18:21 UTC, Nicholas Wilson wrote: On Tuesday, 12 September 2017 at 01:13:29 UTC, Hasen Judy wrote: Is this is a common beginner issue? if `range.save` works use that, otherwise std.csv does not, IIRC. `range.dup` will duplicate the range That isn't a

Re: What the hell is wrong with D?

2017-09-19 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 19:16:05 UTC, EntangledQuanta wrote: The D community preaches all this safety shit but when it comes down to it they don't seem to really care(look at the other responses like like "Hey, C does it" or "Hey, look up the operator precedence"... as if those

Communication was [Re: What the hell is wrong with D?]

2017-09-20 Thread Jesse Phillips via Digitalmars-d-learn
On Wednesday, 20 September 2017 at 02:34:50 UTC, EntangledQuanta wrote: When they then make up excuses to try to justify the wrong and turn it in to a right, they deserved to be attacked. That isn't how it went down, you attacked then justification was provided. for someone that programs in

Re: What the hell is wrong with D?

2017-09-19 Thread Jesse Phillips via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 17:40:20 UTC, EntangledQuanta wrote: I assume someone is going to tell me that the compiler treats it as writeln((x + (_win[0] == '@')) ? w/2 : 0); Yeah, that is really logical! Yeah, I've been bitten by that in languages like C#. I wish D didn't follow in

  1   2   >