On 2011-01-31 2:28, Alex Folland wrote:
scope(failure){writeln(Bad regex);break;}
Oh, that resets the program rather than continuing from where that line
was placed. The continue statement is what I wanted.
Hi,
I've tried to compile programs and Phobos without deprecated features on, and
yet I've come across a problem:
Volatile statements are deprecated.
So, for example, in thread.switchOut(), these statements are invalid:
volatile tobj.m_lock = true;
fiber_switchContext( oldp, newp );
I'm building a function (or template or whatever, really) that is
related to map and minPos in std.algorithm. Basically, it's the
standard mathematical argmin, except that it also returns min. It looks
something like this:
auto minArg(alias fun, Range, T)(Range range, out T minVal) {
Magnus Lie Hetland mag...@hetland.org wrote:
I'm building a function (or template or whatever, really) that is
related to map and minPos in std.algorithm. Basically, it's the standard
mathematical argmin, except that it also returns min. It looks something
like this:
auto minArg(alias
On 2011-01-31 12:55:07 +0100, Simen kjaeraas said:
ElementType!Range minArg( alias fun, Range )( Range range, out
ReturnType!fun ) {
...
}
Aaaah. I guess I tried ElementType(Range), forgetting to make it a
compile-time parameter. Thanks. (Hadn't seen ReturnType; makes sense :)
Might
On Mon, 31 Jan 2011 09:28:25 +0200, Alex Folland lexlex...@gmail.com
wrote:
scope(failure){writeln(Bad regex);break;}
I think the proper construct here is a try/catch block.
--
Best regards,
Vladimirmailto:vladi...@thecybershadow.net
Magnus Lie Hetland mag...@hetland.org wrote:
Might I also ask why you use an out parameter instead of a tuple return?
Well... I had a tuple return at first, but one of the advantages of
returning multiple values that I'm accustomed to is the ability to
assign to multiple variables, such
On 2011-01-31 15:50:41 +0100, Simen kjaeraas said:
You might want to try more from dranges - the reftuple:
_(arg,val) = minArg(...);
[snip]
This is also a possible implementation (coded in about 5 minutes, gives
no nice error messages, but it seems to work :p ):
Thanks :)
Yeah. D has the
On 1/31/11, Simen kjaeraas simen.kja...@gmail.com wrote:
module foo;
import std.typecons;
import std.functional;
import std.array;
template optArg( alias pred ) {
template optArg( alias fn ) {
auto optArg( Range )( Range r ) {
alias binaryFun!pred predicate;
Hello!
I'm trying to convert ANSI characters to UTF8 that but it doesn't
work correctly.
I used the following:
void main() {
writeln(convertToUTF8(�));
}
string convertToUTF8(string text) {
string result;
for (uint i=0; itext.length; i++) {
char ch =
Andrej Mitrovic andrej.mitrov...@gmail.com wrote:
On 1/31/11, Simen kjaeraas simen.kja...@gmail.com wrote:
module foo;
import std.typecons;
import std.functional;
import std.array;
template optArg( alias pred ) {
template optArg( alias fn ) {
auto optArg( Range )( Range r ) {
Hm. Using code quite similar to you, supplying a lambda in the second
aliasing, I get this error:
something.d(93): Error: template instance cannot use local
'__dgliteral2(__T3)' as parameter to non-global template optArg(alias
fun)
It seems it's explicitly objecting to what I want it to
Magnus Lie Hetland mag...@hetland.org wrote:
Hm. Using code quite similar to you, supplying a lambda in the second
aliasing, I get this error:
something.d(93): Error: template instance cannot use local
'__dgliteral2(__T3)' as parameter to non-global template optArg(alias
fun)
It seems
On 1/31/11, Simen kjaeraas simen.kja...@gmail.com wrote:
You can only do that using aliases.
Yeah. I was just experimenting for the last half hour. I was hoping to
make it easier to make an alias to a nested template using the
eponymous trick. But it doesn't work at all. All I could come up
On 01/30/2011 02:49 PM, Tomek Sowiński wrote:
spir spir napisał:
DUnicode has such functionality: https://bitbucket.org/stephan/dunicode/src
Watch inside unicodedata.d, search for general category.
Thanks. Any word of moving some of it into Phobos? It's jarring to see a
Unicode-compliant
On Fri, 28 Jan 2011 16:59:20 -0500, Don nos...@nospam.com wrote:
spir wrote:
Hello,
This fails:
class T0 {}
class T1 : T0 {}
class T2 : T0 {}
unittest {
auto t1 = new T1();
auto t2 = new T2();
T0[] ts = [t1, t2];
}
Error: cannot implicitly convert expression (t1) of type
On 31.01.2011 4:57, Alex Folland wrote:
I wrote this little program to test for regular expression matches. I
compiled it with in Windows with DMD 2.051 through Visual Studio 2010
with Visual D. It crashes if regexbuf is just the single character,
*. Why? Shouldn't it match the entire
On 01/31/2011 09:06 PM, Steven Schveighoffer wrote:
On Fri, 28 Jan 2011 16:59:20 -0500, Don nos...@nospam.com wrote:
spir wrote:
Hello,
This fails:
class T0 {}
class T1 : T0 {}
class T2 : T0 {}
unittest {
auto t1 = new T1();
auto t2 = new T2();
T0[] ts = [t1, t2];
}
Error: cannot implicitly
On 2011-01-31 15:43, Dmitry Olshansky wrote:
On 31.01.2011 4:57, Alex Folland wrote:
I wrote this little program to test for regular expression matches. I
compiled it with in Windows with DMD 2.051 through Visual Studio 2010
with Visual D. It crashes if regexbuf is just the single character,
*.
Magnus Lie Hetland:
Well... I had a tuple return at first, but one of the advantages of
returning multiple values that I'm accustomed to is the ability to
assign to multiple variables, such as
arg, val = minArg(...)
(Yeah, I'm a Python guy... ;)
I will eventually add a detailed
20 matches
Mail list logo