D adds a very handy feature that allows you to check for a range of
values in a single case. Is there a particular reason that the syntax
"case : .. case :" is used instead of treating the case
statement similarly to an array slice, e.g. "case .. :"?
For example:
import std.stdio;
void mai
On Wed, 17 Aug 2011 17:40:40 +, Lars T. Kyllingstad wrote:
> On Wed, 17 Aug 2011 17:27:43 +0000, Vijay Nayar wrote:
>
>> D adds a very handy feature that allows you to check for a range of
>> values in a single case. Is there a particular reason that the syntax
>>
On Wed, 17 Aug 2011 16:29:19 -0400, bearophile wrote:
> Jacob Carlborg:
>
>> D should have a built-in range type. One that supports syntax for both
>> including and excluding the last element:
>>
>> auto a = 3 .. 5
>> auto b = 3 ... 5
>>
>> Then we wouldn't need a special range syntax for switc
On Wed, 17 Aug 2011 17:51:48 -0500, Andrei Alexandrescu wrote:
>
> I doubt that would work well. Let's ignore for now mundane issues such
> as the ambiguity of 3...5 and focus on something like:
>
> int x;
> ...
> switch (x) {
> case 3 ... 5: return 1;
> default: return 0;
> }
>
> We'd need to
On Sat, 27 Aug 2011 16:40:39 +0300, Radu Toev wrote:
There are two possibilities I can imagine:
A. The phobos2 library was somehow incomplete or not built correctly.
To check this possibility, use the 'nm' command and search for the
missing symbol. I used the Ubuntu standard dmd package, so
On Tue, 30 Aug 2011 09:15:48 +0300, Radu Toev wrote:
Ok, so far so good. We know that you have the librt library, and that it
was compiled with the symbols that the compiler is complaining about.
Could you copy the contents of your 'dmd.conf' file? If your setup is
pretty simple, there should
While working on a library built for high efficiency, avoiding
unnecessary copies of structs became an issue. I had assumed
that `in` was doing this, but a bit of experimentation revealed
that it does not. However, `ref in` works great.
My question is, should `in` by default also imply `ref`
I encountered a very unexpected error when working on a project.
It seems that the Appender and RefAppender structs created from
the std.array.appender() method are sensitive to the mere
presence of a method called "init()" on the element type of the
array.
Here is a minimal example:
```
im
I've been experimenting with code that uses std.functional :
binaryFun and unaryFun, but I have found that using these methods
makes it impossible to add function attributes like @safe, @nogc,
pure, and nothrow, because no guarantee can be made about the
functions created via a stream. For exa
On Sunday, 27 May 2018 at 05:25:53 UTC, IntegratedDimensions
wrote:
Re: Friends in D, a new idiom?
In D, there's no exact equivalent to friend, but there are a few
more specialized tools at your disposal. Normally all code in the
same module is essentially a friend, so if the classes you ar
On Sunday, 27 May 2018 at 06:00:30 UTC, IntegratedDimensions
wrote:
The problem description is not very clear, but the catfood
example gives a bit more to work with.
animal -> food
||
vv
cat -> catfood
Of course, I'm not sure how to avoid the problem i
On Saturday, 26 May 2018 at 11:56:30 UTC, Vijay Nayar wrote:
The error is:
```
onlineapp.d(8): Error: function literal `__lambda6(char a)` is
not callable using argument types `(int)`
onlineapp.d(8):cannot pass argument `val` of type `int`
to parameter `char a`
onlineapp.d(15): Error
On Sunday, 27 May 2018 at 06:37:56 UTC, IntegratedDimensions
wrote:
I'm looking for something lightweight and direct. It is not for
total encapsulation control but to simply provide an extra
level of indirection for write access to make the object look
read only to those that directly use it.
On Sunday, 27 May 2018 at 20:38:25 UTC, Daniel Kozak wrote:
I would rewrite it to something like this:
template BTree(ValueT, KeyT = ValueT,alias KeyF =
unaryFun!"cast(const)a")
{
class BTree
{
This is roughly what I originally had, but it creates a number of
problems that I wanted
On Tuesday, 29 May 2018 at 11:36:11 UTC, Yuxuan Shui wrote:
No, wait a second. (a)=>a is in default argument list, so it is
in the global scope. And it was instantiated when you
instantiate BTree with char.
Could you explain that part a bit for me? Yes, (a) => a is a
default value, but whe
On Tuesday, 29 May 2018 at 12:58:20 UTC, Yuxuan Shui wrote:
I believe that is the case. Normally that will be fine, because
you can't modify them. Type-deduced lambda is a very special
case, as in their parameter types are deduced on first use, so
in a sense, they are "modified" by the first i
On Tuesday, 29 May 2018 at 19:17:37 UTC, Vijay Nayar wrote:
On Tuesday, 29 May 2018 at 12:58:20 UTC, Yuxuan Shui wrote:
[...]
I tried this again, this time completely ignoring lambdas and
completely specifying the desired type like so:
[...]
Issue created: https://issues.dlang.org
On Saturday, 9 June 2018 at 02:38:14 UTC, SonicFreak94 wrote:
On Saturday, 9 June 2018 at 02:17:18 UTC, Adam D. Ruppe wrote:
On Saturday, 9 June 2018 at 02:13:00 UTC, Walter Bright wrote:
But it was never enforced, meaning that suddenly enforcing it
is just going to break code left and right.
On Friday, 22 June 2018 at 14:45:46 UTC, Jesse Phillips wrote:
Should I be looking more at the benefits of having D as a tool?
It was a good choice for me since I know D so well (and other
reasons at the time), but C# is a reasonable language in this
space. I'm thinking, like should I go into h
I was in need of an associative array / dictionary object that
could also support getting ranges of entries with keys below or
above a given value. I couldn't find anything that would do
this, and ended up using the RedBlackTree to store key/value
pairs, and then wrap the relevant functions wi
On Thursday, 11 October 2018 at 11:50:39 UTC, Joakim wrote:
On Thursday, 11 October 2018 at 07:58:39 UTC, Russel Winder
wrote:
This was supposed to come to this list not the learn list.
On Thu, 2018-10-11 at 07:57 +0100, Russel Winder wrote:
It seems that in the modern world of Cloud and Kubern
On Friday, 12 October 2018 at 07:13:33 UTC, Russel Winder wrote:
On Thu, 2018-10-11 at 13:00 +, bachmeier via Digitalmars-d
wrote: […]
Suggestions?
My guess is that the reason they've heard of those languages
is because their developers were writing small projects using
Go and Rust, but n
On Friday, 12 October 2018 at 21:08:03 UTC, Jabari Zakiya wrote:
On Friday, 12 October 2018 at 20:05:29 UTC, welkam wrote:
On Friday, 12 October 2018 at 16:19:59 UTC, Jabari Zakiya
wrote:
The real point of the challenge is too see what idiomatic
code...
There is no idiomatic D code. There is
On Saturday, 13 October 2018 at 14:32:33 UTC, welkam wrote:
On Saturday, 13 October 2018 at 09:22:16 UTC, Vijay Nayar wrote:
I downloaded the reference NIM implementation and got the
latest nim compiler, but I received the following error:
$ nim c --cc:gcc --d:release --threads:on
On Saturday, 13 October 2018 at 15:19:07 UTC, Jabari Zakiya wrote:
On Saturday, 13 October 2018 at 14:32:33 UTC, welkam wrote:
On Saturday, 13 October 2018 at 09:22:16 UTC, Vijay Nayar
wrote:
[...]
import algorithm
thats all but then it spits out
lib/nim/pure/algorithm.nim(144, 11) Error
On Saturday, 13 October 2018 at 15:50:06 UTC, Vijay Nayar wrote:
On Saturday, 13 October 2018 at 15:19:07 UTC, Jabari Zakiya
wrote:
On Saturday, 13 October 2018 at 14:32:33 UTC, welkam wrote:
On Saturday, 13 October 2018 at 09:22:16 UTC, Vijay Nayar
wrote:
[...]
import algorithm
thats all
On Saturday, 13 October 2018 at 18:05:45 UTC, Jabari Zakiya wrote:
It may be also running into a hard time limit imposed on
compilation that Nim had/has that prevented my code from
initially compiling. I'm generating a lot of PG parameter
constants at compile time, and it's doing a lot of num
On Saturday, 13 October 2018 at 18:14:20 UTC, Vijay Nayar wrote:
On Saturday, 13 October 2018 at 18:05:45 UTC, Jabari Zakiya
wrote:
It may be also running into a hard time limit imposed on
compilation that Nim had/has that prevented my code from
initially compiling. I'm generating a l
On Saturday, 13 October 2018 at 19:04:48 UTC, Jabari Zakiya wrote:
On Saturday, 13 October 2018 at 18:31:57 UTC, Vijay Nayar wrote:
On Saturday, 13 October 2018 at 18:14:20 UTC, Vijay Nayar
wrote:
On Saturday, 13 October 2018 at 18:05:45 UTC, Jabari Zakiya
wrote:
It may be also running into
On Sunday, 14 October 2018 at 10:51:11 UTC, Vijay Nayar wrote:
Once I get the bugs out, I'm curious to see if any performance
differences crop up. There's the theory that says they should
be the same, and then there's the practice.
I don't actually understand the underly
On Monday, 15 October 2018 at 22:17:57 UTC, Jabari Zakiya wrote:
$ dub build --compiler=ldc2 -b=release && echo "30" |
./twinprimes
Enter integer number:
threads = 8
each thread segment is [1 x 65536] bytes array
twinprime candidates = 175324676; resgroups = 1298702
each 135 threads has
On Wednesday, 17 October 2018 at 21:12:49 UTC, Stefan Koch wrote:
Hi,
reading the other shared thread "shared - i need to be
useful"(https://forum.dlang.org/thread/mailman.4299.1539629222.29801.digitalmar...@puremagic.com)
let me to an important realisation concerning the reason
shareding d
32 matches
Mail list logo