On 2015-12-14 20:20, Mike McKee wrote:
Oh, I found I could do:
$ sudo brew update
$ sudo brew upgrade dmd
Alternatively you can install DMD using DVM [1].
Now it generates this error:
$ dmd -m64 -L-framework -LFoundation test.d
test.d(6): Error: undefined identifier 'selector'
test.d(12):
On Tuesday, 15 December 2015 at 00:16:41 UTC, Jakob Ovrum wrote:
Is there a way to do balanced match with std.regex?
It's only possible with (?R) implemented:
http://php.net/manual/en/regexp.reference.recursive.php
But there is no (?R) in D regex implementation.
On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma
wrote:
For instance, hyphens are often used as part of executable
names on Linux, but if I do this:
$ dmd usage-printer.d
I get the following error:
usage-printer.d: Error: module usage-printer has non-identifier
characters in
On Tuesday, 15 December 2015 at 03:31:18 UTC, Shriramana Sharma
wrote:
I understand that module names need to be valid identifiers in
that other modules would need to import them. But when a file
is intended to be just an executable, why is it mandatory to
give it a module declaration with a va
I understand that module names need to be valid identifiers in that other
modules would need to import them. But when a file is intended to be just an
executable, why is it mandatory to give it a module declaration with a valid
identifier?
For instance, hyphens are often used as part of execut
On Tuesday, 15 December 2015 at 01:29:39 UTC, Jakob Ovrum wrote:
Thanks, that makes sense.
String manipulation in D without regex is pretty nice anyway,
so it's not a big loss.
There is a library named Pegged which can match against balanced
parens:
https://github.com/PhilippeSigaud/Pegged
On Monday, 14 December 2015 at 23:34:28 UTC, tcak wrote:
On Monday, 14 December 2015 at 20:46:41 UTC, Mike McKee wrote:
When I run this piece of code:
// FROM: https://dlang.org/spec/objc_interface.html
module main;
[...]
UDA s cannot be used for functions/methods AFAIK.
It doesn't give an
On Tuesday, 15 December 2015 at 01:07:32 UTC, Chris Wright wrote:
I don't think so.
std.regex looks like it implements only a deterministic finite
automaton, whereas what you are looking for requires a
push-down automaton. It just so happens that a few popular
regex libraries implement PDAs r
On Tue, 15 Dec 2015 00:16:41 +, Jakob Ovrum wrote:
> Is there a way to do balanced match with std.regex?
>
> Example (from [1]):
>
> test -> funcPow((3),2) * (9+1)
>
> I want to match the funcPow((3),2) bit, regardless of the depth of the
> expression in funcPow(*).
>
> https://stackoverfl
On Tuesday, 15 December 2015 at 00:31:45 UTC, Jakob Ovrum wrote:
On Tuesday, 15 December 2015 at 00:22:37 UTC, tsbockman wrote:
I also found `SortedRange.equalRange`, but that sounds like it
has an unreasonable amount of (admittedly O(1)) overhead for
the (extremely common) case in which I am l
On Tuesday, 15 December 2015 at 00:31:45 UTC, Jakob Ovrum wrote:
For sorted arrays you won't find any other standard facility
for doing binary search, but the containers RedBlackTree and
BinaryHeap provide something related.
You could also get the upper bound (SortedRange.upperBound) and
calc
On Tuesday, 15 December 2015 at 00:22:37 UTC, tsbockman wrote:
I also found `SortedRange.equalRange`, but that sounds like it
has an unreasonable amount of (admittedly O(1)) overhead for
the (extremely common) case in which I am looking for only a
single element, not a range.
If your array do
Is there no way to do a simple binary search of a sorted array
using Phobos?
I found `SortedRange.contains`, but that just returns true/false.
I want the index of the element, or the element itself.
I also found `SortedRange.equalRange`, but that sounds like it
has an unreasonable amount of
Is there a way to do balanced match with std.regex?
Example (from [1]):
test -> funcPow((3),2) * (9+1)
I want to match the funcPow((3),2) bit, regardless of the depth
of the expression in funcPow(*).
https://stackoverflow.com/questions/7898310/using-regex-to-balance-match-parenthesis
[1]
On Monday, 14 December 2015 at 20:46:41 UTC, Mike McKee wrote:
When I run this piece of code:
// FROM: https://dlang.org/spec/objc_interface.html
module main;
[...]
UDA s cannot be used for functions/methods AFAIK.
When I run this piece of code:
// FROM: https://dlang.org/spec/objc_interface.html
module main;
extern (Objective-C)
interface Class
{
NSString alloc() @selector("alloc");
}
extern (Objective-C)
interface NSString
{
NSString initWithUTF8String(in char* str)
@selector("initWithUTF8String:")
On Monday, 14 December 2015 at 19:15:22 UTC, Mike McKee wrote:
On Monday, 14 December 2015 at 19:13:20 UTC, bachmeier wrote:
Is it okay if I copy your post to the wiki at this link?
http://wiki.dlang.org/Cookbook
Sure! :)
Feel free to fix grammar or anything out of sorts (or could be
better
On Monday, 14 December 2015 at 18:13:02 UTC, Mike McKee wrote:
I think I installed dmd through homebrew. I don't know how to
update it -- I'm still green when it comes to homebrew and only
know apt-get from Ubuntu Linux.
Oh, I found I could do:
$ sudo brew update
$ sudo brew upgrade dmd
Now
On Monday, 14 December 2015 at 19:17:00 UTC, Andre wrote:
It seems to be a regression
https://issues.dlang.org/show_bug.cgi?id=1550
I will open a ticket for this issue
https://issues.dlang.org/show_bug.cgi?id=15443
On Monday, 14 December 2015 at 19:13:20 UTC, bachmeier wrote:
Is it okay if I copy your post to the wiki at this link?
http://wiki.dlang.org/Cookbook
Sure! :)
Feel free to fix grammar or anything out of sorts (or could be
better said), if you want. My goal is to enable more people to be
abl
On Monday, 14 December 2015 at 17:50:26 UTC, Andre wrote:
Hi,
there is an issue with the example from
http://wiki.dlang.org/Win32_DLLs_in_D
While executing the DYNAMIC_LOAD version, the application
will exit on statement: if (!Runtime.unloadLibrary(h))
Neither "error freeing mydll.dll" nor "En
Is it okay if I copy your post to the wiki at this link?
http://wiki.dlang.org/Cookbook
On Monday, 14 December 2015 at 17:28:20 UTC, Jacob Carlborg wrote:
[1] http://dlang.org/spec/objc_interface.html
Unfortunately, my version of DMD on this OSX doesn't support the
(Objective-C) extern when I run the example given at the bottom
of that objc_interface.html page.
$ dmd -m64 -L-f
Hi,
there is an issue with the example from
http://wiki.dlang.org/Win32_DLLs_in_D
While executing the DYNAMIC_LOAD version, the application
will exit on statement: if (!Runtime.unloadLibrary(h))
Neither "error freeing mydll.dll" nor "End..." is written
to the console.
The application just ends
On 2015-12-14 11:09, Mike McKee wrote:
As for D calling the Apple Foundation Classes, they are, evidently,
available to C++, so perhaps they can be loaded in D.
They're not available in C++. They're available in Objective-C++, which
is a different language.
Yes, they can be accessed from D
Adam D. Ruppe wrote:
> but yours won't because to!ubyte(spec, 6) might just be > 240.
Thanks for that explanation. That's clear now.
--
Shriramana Sharma, Penguin #395953
On Monday, 14 December 2015 at 11:45:50 UTC, Namal wrote:
foreach(k;1..11){
auto t = prim_factors(k,P);
v~= [k,product(t)];
}
it crashes because your first t in the loop is an empty array
because 1 is not a prime ( in "prim_sieve" :
On Monday, 14 December 2015 at 13:33:41 UTC, Shriramana Sharma
wrote:
ubyte code = to!ubyte(spec, 6) + 16;
That's not an integer literal... that's a runtime value of ubyte
plus an integer literal.
Since the ubyte is the result of a runtime function, the compiler
doesn't know what it will be
They are promoted to int in arithmetic operations unless compiler
can prove the value doesn't exceed its range.
Hello. I was trying to do something like this:
ubyte code = to!ubyte(spec, 6) + 16;
and got an error saying:
cannot implicitly convert expression (cast(int)to(spec, 6) + 16) of type int
to ubyte
Looking at http://dlang.org/spec/lex.html#IntegerLiteral, sure enough 16 is
specified to be inferr
On Sunday, 13 December 2015 at 01:01:07 UTC, cym13 wrote:
That's because you want to modify it in product passing it by
ref.
Hmm, that seems different to c++.
On Sunday, 13 December 2015 at 11:37:50 UTC, cym13 wrote:
As cryptic as it is this means that the range you passed to
reduce is e
On Monday, 14 December 2015 at 11:12:03 UTC, Ali Çehreli wrote:
On 12/14/2015 02:09 AM, Mike McKee wrote:
I finally managed to get it working
Congratulations! But this is not the right medium for this blog
post. ;) Please polish and publish it somewhere before someone
puts it on Reddit now.
On 12/14/2015 02:09 AM, Mike McKee wrote:
I finally managed to get it working
Congratulations! But this is not the right medium for this blog post. ;)
Please polish and publish it somewhere before someone puts it on Reddit
now. :)
Ali
I finally managed to get it working, using some help from this
forum and stackoverflow.com, and a little bit of random luck with
tests.
// test.d
extern (C++) immutable(char)* dfunc(const char *s) {
import std.string;
return toStringz(fromStringz(s) ~ "-response");
}
I compiled
On Sunday, 13 December 2015 at 18:54:24 UTC, Robert M. Münch
wrote:
Hi, I just wanted to naively copy an object and used:
a = myobj.dup;
[...]
A naive clone method for objects:
https://github.com/rumbu13/sharp/blob/c34139449a078618e807a3f206541656df1bea6a/src/system/package.d#L46
35 matches
Mail list logo