Re: Setting a list of values

2016-05-07 Thread Brian Schott via Digitalmars-d-learn
On Monday, 2 May 2016 at 10:15:04 UTC, Marc Schütz wrote: This check can be done purely by looking at the tokens. In other words it's trivial for D-Scanner to warn about this. https://github.com/Hackerpilot/Dscanner/issues/341

Re: what's wrong with my class?

2016-05-04 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 23:19:08 UTC, Jonathan Villa wrote: What I'm doing wrong? :< All right. D's type system is marking the `Session` constructor as `shared`. This makes the check `static if (is(typeof(result.__ctor(args` in std.conv.emplace fail because `result` is a non-shared

Re: what's wrong with my class?

2016-05-04 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 23:34:52 UTC, Jonathan Villa wrote: On Wednesday, 4 May 2016 at 23:33:28 UTC, Brian Schott wrote: On Wednesday, 4 May 2016 at 23:19:08 UTC, Jonathan Villa wrote: What I'm doing wrong? :< I see that the types of `id_user` aren't necessarily the same between

Re: what's wrong with my class?

2016-05-04 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 4 May 2016 at 23:19:08 UTC, Jonathan Villa wrote: What I'm doing wrong? :< I see that the types of `id_user` aren't necessarily the same between `create` and `this`.

Re: Why is Linux the only OS in version identifier list that has a lowercase name?

2016-04-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 April 2016 at 23:01:08 UTC, marcpmichel wrote: Is it because Linux is not an OS ? :p I gnu somebody would bring that up.

Re: Can file name, module name, class name and variable name be the same?

2016-01-18 Thread Brian Schott via Digitalmars-d-learn
On Monday, 18 January 2016 at 05:20:42 UTC, WhatMeWorry wrote: I can workaround the problem but it seems like a kludge; I'm curious about the subtleties of this problems. You can't have a variable with the same name as a module because they're both symbols with the same name. It messes up the

Re: AliasSeq + isExpression type specialization behavior

2015-11-10 Thread Brian Schott via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 10:28:45 UTC, Marc Schütz wrote: This fails, too: static assert(is(AliasSeq!(char) : AliasSeq!(dchar))); Which makes sense IMO, because it can be thought of as an unnamed struct, cp. the following: struct A { char c; } struct B { dchar c; } static assert(is(A

Re: Associative arrays

2015-11-09 Thread Brian Schott via Digitalmars-d-learn
On Tuesday, 10 November 2015 at 01:29:11 UTC, Brian Schott wrote: Yes. It's a hack that gives you a modulus without having to do a modulus. It only works on powers of two. http://graphics.stanford.edu/~seander/bithacks.html#ModulusDivisionEasy

AliasSeq + isExpression type specialization behavior

2015-11-09 Thread Brian Schott via Digitalmars-d-learn
Given the following code: ``` import std.meta; static assert(is(char : dchar)); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, char))); static assert(is(AliasSeq!(int, char) : AliasSeq!(int, dchar))); ``` The third static assert fails. Should it, given that the first and second pass?

Re: Parse d source file by using compiler

2015-11-09 Thread Brian Schott via Digitalmars-d-learn
On Monday, 9 November 2015 at 05:49:25 UTC, tcak wrote: I checked for a flag in this page http://dlang.org/dmd-linux.html , but couldn't have found any for this purpose. Is there a way to parse a d source file so it generates a tree in JSON, XML, or something-that-can-be-processed-easily

Re: Associative arrays

2015-11-09 Thread Brian Schott via Digitalmars-d-learn
On Monday, 9 November 2015 at 21:33:09 UTC, TheFlyingFiddle wrote: On Monday, 9 November 2015 at 04:52:37 UTC, rsw0x wrote: On Monday, 9 November 2015 at 04:29:30 UTC, Rikki Cattermole wrote: Fwiw, EMSI provides high quality containers backed by std.experimental.allocator.

Re: Problem Benchmarking HashSet from containers-em

2015-10-22 Thread Brian Schott via Digitalmars-d-learn
On Thursday, 22 October 2015 at 22:06:47 UTC, Nordlöw wrote: Can't I use InSituRegion in this way? No. InSituRegion is not copyable. Try creating a `HashSet!(InSituRegion*)` instead.

Re: Feature or bug: print braces

2015-05-13 Thread Brian Schott via Digitalmars-d-learn
On Thursday, 14 May 2015 at 00:29:06 UTC, Dennis Ritchie wrote: Why doesn't the compiler produces an error? - import std.stdio; void main() { writeln({}); } - http://ideone.com/qTZCAd You told it to output a function literal, so it did. (That or you told it to output a

Re: Multiple template alias parameters

2015-05-08 Thread Brian Schott via Digitalmars-d-learn
On Friday, 8 May 2015 at 02:03:17 UTC, Rikki Cattermole wrote: Can you not use something like this? Yes. I was getting confused by another problem that I had just worked on before this one.

Re: Multiple template alias parameters

2015-05-08 Thread Brian Schott via Digitalmars-d-learn
On Friday, 8 May 2015 at 12:44:31 UTC, Artur Skawina wrote: On 05/08/15 03:53, Brian Schott via Digitalmars-d-learn wrote: The problem occurs when I want to register multiple modules to scan for functions. The grammar does not allow this syntax: ``` template (alias Modules

Multiple template alias parameters

2015-05-07 Thread Brian Schott via Digitalmars-d-learn
I have some code that automatically wires up control flow based on annotations. Use of this code looks something like this: ``` import some_package.some_module; void main(string[] args) { doMagicStuff!(some_package.some_module)(args); } ``` All of this works and everything is happy (Except

Re: getopt helpWanted

2015-04-29 Thread Brian Schott via Digitalmars-d-learn
What you're trying to do is currently impossible. I filed a bug (https://issues.dlang.org/show_bug.cgi?id=14525) because what you're trying to do really should be possible. import std.stdio : writefln; import std.getopt; void main(string[] args) { string fname; try {

Re: What ?

2015-03-30 Thread Brian Schott via Digitalmars-d-learn
On Monday, 30 March 2015 at 22:34:00 UTC, matovitch wrote: Hi again again, ulong u = 1 63; Raise : Error: shift by 63 is outside the range 0..31 This is a bug isn't it, the ulong are supposed to be on 64 bits ? I guess it's time I go to bed. Have a nice night ! The problem is that `1`

Re: generate unique variable names?

2014-10-07 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 8 October 2014 at 01:16:50 UTC, K.K. wrote: Is there a way to generate variable names using strings? What I'm trying to do in this particular case is use a for loop, to generate variables (then probably put them in an array in the end) that represent images. So the name is pretty

Re: GC-less Hash-Tables (AA)

2014-09-17 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 17 September 2014 at 15:27:40 UTC, Justin Whear wrote: These containers are all certified GC-free. With the exception of getting keys and values arrays. Those return GC memory to the caller. I'm pretty sure it's documented that it does that though. Everything else uses

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

2014-08-27 Thread Brian Schott via Digitalmars-d-learn
On Wednesday, 27 August 2014 at 19:25:42 UTC, Gary Willoughby wrote: Why don't you need to dereference the pointer 'foo' to reach its member 'bar'? The compiler inserts the dereference for you. (It knows which types are references and which are values and can do this correctly) This makes

Re: DIP64 - Regarding 'pure' and 'nothrow'

2014-08-27 Thread Brian Schott via Digitalmars-d-learn
I'd be more convinced if the following statements were false: 1. Writing an automated upgrade tool is difficult 2. The compiler would have no way of knowing what @nothrow means

Re: DIP64 - Regarding 'pure' and 'nothrow'

2014-08-27 Thread Brian Schott via Digitalmars-d-learn
It would be nice if we could at least allow both nothrow and @nothrow. Because nothrow is already a keyword there's no possibility of a UDA overriding it. This would at least give people the option of making their code look nicer. The delete keyword is deprecated[1] and making that decision

Whath the heck does this do?

2014-08-18 Thread Brian Schott via Digitalmars-d-learn
alias extern(Windows) HRESULT fnNtQuerySystemInformation( uint SystemInformationClass, void* info, uint infoLength, uint* ReturnLength ) nothrow; If you know, respond here or at the following bug report: https://issues.dlang.org/show_bug.cgi?id=13309

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just here to suck ? They are and they do.

Re: Are Delimited strings and HereDoc strings just here to suck ?

2014-08-11 Thread Brian Schott via Digitalmars-d-learn
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote: On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote: I mean when writing a D lexer, you necessarly reach the moment when you think: Oh no! is this feature just here to suck ? They are and they do. Also, use this:

Re: Is there a way to map associative arrays

2014-08-01 Thread Brian Schott via Digitalmars-d-learn
On Friday, 1 August 2014 at 23:33:22 UTC, Freddy wrote: On Friday, 1 August 2014 at 23:22:06 UTC, bearophile wrote: Freddy: uint[uint] test; void main(){ test=[0:2 ,1:3 ,2:4]; writeln(test.map!(a=a-2)); } If you need keys or values you have .keys .values, .byKey, .byValue

Re: RegEx for a simple Lexer

2014-05-13 Thread Brian Schott via Digitalmars-d-learn
On Tuesday, 13 May 2014 at 19:53:17 UTC, Tim Holzschuh via Digitalmars-d-learn wrote: Hi there, I read a book about an introduction to creating programming languages (really basic). The sample code is written in Ruby, but I want to rewrite the examples in D. However, the Lexer uses Ruby's