On Monday, 3 November 2014 at 22:26:14 UTC, Jack wrote:
I'll try and think about this for a while
Thanks for the help sir.
No worries. I don't really know what else to suggest without
seeing a little code. Do you have a simple full program that
shows the error happening?
On Monday, 3 November 2014 at 14:53:29 UTC, Ali Çehreli wrote:
It sounds possible but I don't understand it yet. Can you give
an example of the input and output to the D code?
Ali
Thank you Ali.
I realized, that my wishes look like serialization.
So i decide read and learn code from existent
On Monday, 3 November 2014 at 17:05:21 UTC, John Colvin wrote:
static if (is(typeof(T) == int))
should be
static if (is(T == int))
T is already a type.
I thought this was supposed to produce an error message rather
than fail silently... I'm positive this used to be an error. Did
it
Sometimes I have a function that needs an iterable:
void foo(Range)(Range data)
if (isForwardRange!Range is(Unqual!(ForeachType!Range) ==
int)) {}
So is it a good idea to add a isRangeOf template to Phobos?
void foo(Range)(Range data)
if (isRangeOf!(Range, int)) {}
Bye,
bearophile
On Tuesday, 4 November 2014 at 08:30:34 UTC, Gary Willoughby
wrote:
On Monday, 3 November 2014 at 22:26:14 UTC, Jack wrote:
I'll try and think about this for a while
Thanks for the help sir.
No worries. I don't really know what else to suggest without
seeing a little code. Do you have a
On 11/4/2014 7:34 PM, Jack wrote:
On Tuesday, 4 November 2014 at 08:30:34 UTC, Gary Willoughby
Here's the main file:
http://codepad.org/hu4r0ExB
and Here's the module:
http://codepad.org/ikXAzfdg
Dependencies are DerelictSDL and Tkd.
It's the most simple one I got that reproduces the
https://issues.dlang.org/show_bug.cgi?id=12990 this?
On Tuesday, November 04, 2014 07:19:03 Algo via Digitalmars-d-learn wrote:
Is it possible?
As in
{
int a;
a.opUnary!++();
}
no property 'opUnary' for type 'int'
opUnary only exists when it's been declared on a user-defined type. The way
to use it generically is to use the
On Tuesday, November 04, 2014 09:40:58 bearophile via Digitalmars-d-learn wrote:
Sometimes I have a function that needs an iterable:
void foo(Range)(Range data)
if (isForwardRange!Range is(Unqual!(ForeachType!Range) ==
int)) {}
So is it a good idea to add a isRangeOf template to Phobos?
Jonathan M Davis:
That loses the ability to test which type of range you're
talking about.
Yes, one can think about templates like isForwardRangeOf, etc.
But for such specialized cases I think using
isForwardRange+is(ElementType) is acceptable and avoids adding
too many templates to
On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote:
The following
struct DATA {
short* data;
size_t len;
}
// data and len are provided by a C function
// ...
auto data = mymodule.getSpeechData();
// cast to immutable, because of concurrency
immutable short* tmp =
The following
struct DATA {
short* data;
size_t len;
}
// data and len are provided by a C function
// ...
auto data = mymodule.getSpeechData();
// cast to immutable, because of concurrency
immutable short* tmp = cast(immutable)(data.data);
auto proc = spawn(processData, thisTid);
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote:
Hi!
The following code does not correctly handle Unicode strings.
-
import std.stdio;
void main () {
string s;
readf (%s, s);
write (s);
}
-
Example input (Test. in cyrillic):
-
Тест.
-
On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote:
The following
struct DATA {
short* data;
size_t len;
}
// data and len are provided by a C function
// ...
auto data = mymodule.getSpeechData();
// cast to immutable, because of concurrency
immutable short* tmp =
On Tuesday, 4 November 2014 at 14:01:16 UTC, anonymous wrote:
On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote:
The following
struct DATA {
short* data;
size_t len;
}
// data and len are provided by a C function
// ...
auto data = mymodule.getSpeechData();
// cast to immutable,
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
On Tuesday, 4 November 2014 at 14:01:16 UTC, anonymous wrote:
On Tuesday, 4 November 2014 at 12:47:11 UTC, Chris wrote:
The following
struct DATA {
short* data;
size_t len;
}
// data and len are provided by a C function
// ...
auto
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
I'm still curious, though, how D handles this internally,
because data.data is still mutable while the other reference to
the same address (tmp) is not. What if I change data.data while
the other thread is being executed?
Changing
On Tuesday, 4 November 2014 at 14:47:49 UTC, anonymous wrote:
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
I'm still curious, though, how D handles this internally,
because data.data is still mutable while the other reference
to the same address (tmp) is not. What if I change
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
I'm still curious, though, how D handles this internally,
because data.data is still mutable while the other reference to
the same address (tmp) is not. What if I change data.data while
the other thread is being executed?
immutable is
On Tuesday, 4 November 2014 at 16:07:11 UTC, thedeemon wrote:
On Tuesday, 4 November 2014 at 14:36:19 UTC, Chris wrote:
I'm still curious, though, how D handles this internally,
because data.data is still mutable while the other reference
to the same address (tmp) is not. What if I change
There is assumeUnique which effectively does cast to immutable
but is more clear to the reader in a sense why breaking type
system was considered legit. I recommend using it over raw cast.
On Monday, 3 November 2014 at 20:03:03 UTC, Ali Çehreli wrote:
On 11/03/2014 11:47 AM, Ivan Kazmenko wrote:
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko
wrote:
readf (%s, s);
Worth noting: this reads to end-of-file (not end-of-line or
whitespace),
and reading the whole file
On Monday, 3 November 2014 at 20:10:02 UTC, Gary Willoughby wrote:
On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko wrote:
So, if there is an idiomatic way to read the whole file into a
string which is Unicode-compatible, it would be great to learn
that, too.
Maybe something like
On Tuesday, 4 November 2014 at 11:46:24 UTC, Kagamin wrote:
https://issues.dlang.org/show_bug.cgi?id=12990 this?
Similar, but not quite that. Bugs 12990 and 1448 (linked from
there) seem to have Windows console as an important part of the
process. For me, the example does not work even
On Tuesday, 4 November 2014 at 10:34:19 UTC, Jack wrote:
No worries. I don't really know what else to suggest without
seeing a little code. Do you have a simple full program that
shows the error happening?
Here's the main file:
http://codepad.org/hu4r0ExB
and Here's the module:
On Tuesday, 4 November 2014 at 13:01:48 UTC, anonymous wrote:
On Monday, 3 November 2014 at 19:37:20 UTC, Ivan Kazmenko wrote:
Hi!
The following code does not correctly handle Unicode strings.
-
import std.stdio;
void main () {
string s;
readf (%s, s);
write (s);
}
On Tuesday, 4 November 2014 at 18:22:49 UTC, Gary Willoughby
wrote:
On Tuesday, 4 November 2014 at 10:34:19 UTC, Jack wrote:
No worries. I don't really know what else to suggest without
seeing a little code. Do you have a simple full program that
shows the error happening?
Here's the main
what am I doing wrong here?
import std.math;
import std.stdio;
void main()
{
real fac;
fac=1.2;
fac=rndtonl(fac);
}
[root@fedorabox util]# dmd bug.d
bug.o: In function `_Dmain':
bug.d:(.text._Dmain+0x3b): undefined reference to `rndtonl'
collect2: error: ld returned 1
On Tuesday, 4 November 2014 at 18:09:48 UTC, Ivan Kazmenko wrote:
On Monday, 3 November 2014 at 20:10:02 UTC, Gary Willoughby
wrote:
On Monday, 3 November 2014 at 19:47:17 UTC, Ivan Kazmenko
wrote:
So, if there is an idiomatic way to read the whole file into
a string which is
I think rndtonl is a C library function that isn't always present
in the system.
It doesn't work on my computer either and I can't find any
documentation about it. It is probably not meant to be called by
end users.
On Tuesday, 4 November 2014 at 10:34:19 UTC, Jack wrote:
Here's the main file:
http://codepad.org/hu4r0ExB
and Here's the module:
http://codepad.org/ikXAzfdg
Dependencies are DerelictSDL and Tkd.
It's the most simple one I got that reproduces the error.
If you change the way SDL is
Perhaps I am expecting too much from the current 'in' contract design
and implementation. ;)
Still, the virtual function call in the following interface's 'in'
contract should be dispatched to the implementaion in the derived class,
right?
It seems like mere presence of that virtual
Ali Çehreli:
Perhaps I am expecting too much from the current 'in' contract
design and implementation. ;)
The in contract is named pre-condition, or precondition.
Bye,
bearophile
Is there a very easy way to search a file for a string, then
extract to a new file everything from that match on to the end of
the file?
I basically want to remove a header from a file(it's length is
not fixed though).
It seems I'm having to convert bytes to chars to strings and back
and
On 11/4/14 3:01 PM, Ali Çehreli wrote:
Perhaps I am expecting too much from the current 'in' contract design
and implementation. ;)
Still, the virtual function call in the following interface's 'in'
contract should be dispatched to the implementaion in the derived class,
right?
It seems like
On 11/4/14 3:26 PM, Steven Schveighoffer wrote:
On 11/4/14 3:01 PM, Ali Çehreli wrote:
Perhaps I am expecting too much from the current 'in' contract design
and implementation. ;)
Still, the virtual function call in the following interface's 'in'
contract should be dispatched to the
On 11/04/2014 12:41 PM, Steven Schveighoffer wrote:
Yep. I debugged it. It's calling toHash instead.
Yeah, you were spot on. :) I did a different experiment. I added a
number of functions to the interface (before virtualCheck()) and
implementations to the class:
interface I
{
// ...
On Tuesday, November 04, 2014 20:12:21 Sativa via Digitalmars-d-learn wrote:
Is there a very easy way to search a file for a string, then
extract to a new file everything from that match on to the end of
the file?
I basically want to remove a header from a file(it's length is
not fixed
On Tuesday, 4 November 2014 at 00:32:52 UTC, bioinfornatics wrote:
On Monday, 3 November 2014 at 23:53:53 UTC, bioinfornatics
wrote:
Dear,
why this code fail to build http://dpaste.dzfl.pl/8ef3898b05d2
?
I try to have a structure which is used to fill information
from
a file.
And I use
On 11/04/2014 01:58 PM, bioinfornatics wrote:
test.d(40): Error: type Section!((letter) = letter == '',
(letter) = letter == '\x0a') has no value
You have this line:
@Section!(/* ... */)
Although that is a type name, there is a bug somewhere and sometimes you
have to use a 'value' as a
On 11/04/2014 12:26 PM, Steven Schveighoffer wrote:
This looks like a dmd bug.
Posted:
https://issues.dlang.org/show_bug.cgi?id=13687
Ali
41 matches
Mail list logo