On 2012-04-23 01:21, Era Scarecrow wrote:
I think I have a misunderstanding of how 'package' is suppose to work.
How I understand it, you will give access to the directory, unlike
private which will hide it outside of the same file.
This problem comes up since a struct is declared inside a packa
On Sunday, 22 April 2012 at 23:19:52 UTC, Joseph Rushton Wakeling
wrote:
import std.random, std.range, std.stdio;
void
printRandomNumbers(RandomNumberGenerator)(RandomNumberGenerator
rng, size_t n)
{
foreach(i; 0..n)
write
On Sunday, 22 April 2012 at 00:36:19 UTC, bearophile wrote:
Performing the toLower every time the cmp function is called
doesn't change the O complexity. In Phobos there is an
alternative sorting (Schwartzian sorting routime) that applies
a function to each item before sorting them, usually is
On 23/04/12 06:10, Ali Çehreli wrote:
You just need to call the delegate with the function call syntax:
writeln(rng());
... but what I get in my code is that printRandomNumbers then prints out n times
the _same number_, instead of 5 different ones. i.e. when the delegate is
passed its retur
On 04/22/2012 04:19 PM, Joseph Rushton Wakeling wrote:
Is there a way in which to pass a function as input to another function,
with the arguments of the first function already determined?
The case I'm thinking of is one where I have a function which wants to
take a random number generation sche
On 04/22/2012 07:15 PM, Casey wrote:
Hello,
I'm getting some errors when I wrap a struct that I've written with
another struct. Here are the errors I'm getting:
tqueue.d(14): Error: function queue.Queue!(int).Queue.enqueue (int
value) is not
callable using argument types (int) shared
tqueue.d(1
Hello,
I'm getting some errors when I wrap a struct that I've written
with another struct. Here are the errors I'm getting:
tqueue.d(14): Error: function queue.Queue!(int).Queue.enqueue
(int value) is not
callable using argument types (int) shared
tqueue.d(15): Error: function queue.Queue!
On 04/22/2012 03:17 PM, Stephen Jones wrote:
> Thanks for the replies. I am still uncertain about something. The
> documentation distinguishes between dynamic slices (int[5] a = new
> int[5])
The documentation may be incorrect because int[5] is never a slice. It
is a fixed-length array.
As an
On Monday, April 23, 2012 02:40:42 Adam D. Ruppe wrote:
> On Sunday, 22 April 2012 at 23:54:17 UTC, Jonathan M Davis wrote:
> > Well, strict enforcement is how @property was designed in the
> > first place (and is how it's described in TDPL).
>
> That doesn't affect my argument at all,
>
> People
On Sunday, 22 April 2012 at 23:54:17 UTC, Jonathan M Davis wrote:
Well, strict enforcement is how @property was designed in the
first place (and is how it's described in TDPL).
That doesn't affect my argument at all,
People actually use the implementation as it is, which
is a superset of the T
On Monday, April 23, 2012 01:59:15 Era Scarecrow wrote:
> On Sunday, 22 April 2012 at 23:32:40 UTC, Jonathan M Davis wrote:
> > 1. Package access is _very_ broken:
> > http://d.puremagic.com/issues/show_bug.cgi?id=143
>
> Fun... So it's not just me... Guess for the 1-2 places I 'll
> need packag
Related to my earlier question -- I was wondering if there's a trivial way of
generating a range of n random numbers according to a given distribution and
parameters.
I wrote up the code below to generate a range of n uniformly-distributed
numbers, but am not sure how to generalize it for arbi
On Sunday, 22 April 2012 at 23:32:40 UTC, Jonathan M Davis wrote:
1. Package access is _very_ broken:
http://d.puremagic.com/issues/show_bug.cgi?id=143
Fun... So it's not just me... Guess for the 1-2 places I 'll
need package level access instead I gotta either do public or get
some getters
On Monday, April 23, 2012 01:39:44 Adam D. Ruppe wrote:
> On Sunday, 22 April 2012 at 23:21:57 UTC, Jonathan M Davis wrote:
> > Well, I completely disagree with you on @property.
>
> Note: my problem is with -property, not @property.
>
> If @property was correctly implemented, it'd serve
> a very
On Sunday, 22 April 2012 at 23:21:57 UTC, Jonathan M Davis wrote:
Well, I completely disagree with you on @property.
Note: my problem is with -property, not @property.
If @property was correctly implemented, it'd serve
a very nice purpose. The reason I'm aware of the
bug is this is something I
On Monday, April 23, 2012 01:21:21 Era Scarecrow wrote:
> I think I have a misunderstanding of how 'package' is suppose to
> work. How I understand it, you will give access to the directory,
> unlike private which will hide it outside of the same file.
1. Package access is _very_ broken:
http:/
On Sunday, 22 April 2012 at 23:01:26 UTC, jerro wrote:
On Sunday, 22 April 2012 at 22:17:11 UTC, Stephen Jones wrote:
Thanks for the replies. I am still uncertain about something.
The documentation distinguishes between dynamic slices (int[5]
a = new int[5]) which are managed by the runtime, an
On 23/04/12 01:19, Joseph Rushton Wakeling wrote:
void main()
{
foreach(double upper; iota(1.0, 2.0, 0.2) ) {
double delegate() rng = () {
return uniform(0.0, 1.0);
};
printRandomNumbers(rng,10);
}
}
That was meant to be,
double delegate() rng =
I think I have a misunderstanding of how 'package' is suppose to
work. How I understand it, you will give access to the directory,
unlike private which will hide it outside of the same file.
This problem comes up since a struct is declared inside a
package (and even instantiated), however ac
On Monday, April 23, 2012 01:01:48 Adam D. Ruppe wrote:
> On Sunday, 22 April 2012 at 22:36:12 UTC, Jonathan M Davis wrote:
> > Eventually -property will be the normal behavior.
>
> Note that -property adds zero value, much like the current
> implementation of @property, which fails to disambiguat
Is there a way in which to pass a function as input to another function, with
the arguments of the first function already determined?
The case I'm thinking of is one where I have a function which wants to take a
random number generation scheme, and use it on several occasions, without having
a
On Sunday, 22 April 2012 at 22:36:12 UTC, Jonathan M Davis wrote:
Eventually -property will be the normal behavior.
Note that -property adds zero value, much like the current
implementation of @property, which fails to disambiguate
cases:
==
import std.stdio;
alias void delegate() callable;
On Sunday, 22 April 2012 at 22:17:11 UTC, Stephen Jones wrote:
Thanks for the replies. I am still uncertain about something.
The documentation distinguishes between dynamic slices (int[5]
a = new int[5]) which are managed by the runtime, and stack
allocated arrays (int[5] b). The problem I have
On Sunday, April 22, 2012 22:30:01 David wrote:
> For now you can do it *without* @property and compile *without* -property
But that will not remain the case, so relying on that is not a good idea.
Eventually -property will be the normal behavior.
As for opPropDispatch, I don't think that it's s
Thanks for the replies. I am still uncertain about something. The
documentation distinguishes between dynamic slices (int[5] a =
new int[5]) which are managed by the runtime, and stack allocated
arrays (int[5] b). The problem I have is this. I want to be
loading vertex positions and tex-coords
On Sunday, 22 April 2012 at 21:50:32 UTC, Dmitry Olshansky wrote:
Omagad, thank you, too much Java is bd for your brains.
On 04/22/2012 11:47 PM, SomeDude wrote:
Sorry for the noob questions, but
import std.stdio;
struct Foo {
int x;
}
void main() {
auto array = new Foo[10];
auto i = array.length;
foreach(Foo f; array) { f.x = --i; write(f.x);}
Use ref when you want to modify the original array, without ref you
On 23.04.2012 1:47, SomeDude wrote:
Sorry for the noob questions, but
import std.stdio;
struct Foo {
int x;
}
void main() {
auto array = new Foo[10];
auto i = array.length;
foreach(Foo f; array) { f.x = --i; write(f.x);}
writeln();
foreach(Foo f; array) { write(f.x);}
Here: Foo f is not a ref
Sorry for the noob questions, but
import std.stdio;
struct Foo {
int x;
}
void main() {
auto array = new Foo[10];
auto i = array.length;
foreach(Foo f; array) { f.x = --i; write(f.x);}
writeln();
foreach(Foo f; array) { write(f.x);}
}
gives me:
PS E:\DigitalMars\dmd2\sa
On Saturday, 21 April 2012 at 23:24:57 UTC, Jay Norwood wrote:
While playing with sorting the unzip archive entries I tried
use of the last example in
http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!("toLower(a.name) <
toLower(b.name)",std.algorithm.SwapStrategy.stable)(ent
On 04/16/2012 09:27 PM, sclytrack wrote:
On 04/16/2012 08:15 PM, sclytrack wrote:
const numbers = new int[2];
const c = const(AB)(a, 20, numbers);
writeln(c);
}
Bye,
bearophile
That's exactly what I needed, thanks.
Seems to be forwarded to the constructor if there is one.
(untested code
Am 22.04.2012 22:11, schrieb sclytrack:
struct Dispatcher
{
@property
void opDispatch(string name)(string val)
{
writeln(val);
}
@property
string opDispatch(string name)()
{
return "getter";
}
void opDispatch(string name)()
{
writeln(name);
}
}
I can't seem to make a "dispatcher" that suppo
struct Dispatcher
{
@property
void opDispatch(string name)(string val)
{
writeln(val);
}
@property
string opDispatch(string name)()
{
return "getter";
}
void opDispatch(strin
On 22/04/12 19:18, Jesse Phillips wrote:
On Sunday, 22 April 2012 at 15:26:34 UTC, Joseph Rushton Wakeling wrote:
/usr/local/include/d2/std/zlib.d(26): Error: module zlib is in file
'etc/c/zlib.d' which cannot be read
import path[0] = /usr/local/include/d2/
Do you see the file:
/usr/local/inc
On Sunday, 22 April 2012 at 15:26:34 UTC, Joseph Rushton Wakeling
wrote:
/usr/local/include/d2/std/zlib.d(26): Error: module zlib is
in file 'etc/c/zlib.d' which cannot be read
import path[0] = /usr/local/include/d2/
Do you see the file:
/usr/local/include/d2/etc/c/zlib.d ?
If not, then
On Saturday, 21 April 2012 at 22:18:02 UTC, Adam D. Ruppe wrote:
We can do not null in the library reasonably
well. I have a basic one in github:
https://github.com/D-Programming-Language/phobos/pull/477
I'm thinking those interested in not null will want something
similar to the maybe type.
Hello all,
I currently have a self-compiled and installed dmd, druntime, phobos and rdmd on
Ubuntu 12.04. I get the following error message whenever I try to use rdmd or
equivalently dmd -run:
/usr/local/include/d2/std/zlib.d(26): Error: module zlib is in file
'etc/c/zlib.d' which cannot
On Sunday, 22 April 2012 at 00:06:47 UTC, Adam D. Ruppe wrote:
I just pushed an update to git with
a few changes people have suggested.
I removed one of the old opAssigns
to keep a static type check.
Added assumeNotNull and checkNotNull
as entry points.
I didn't recognized this part until now
On 2012-04-22 01:24, Jay Norwood wrote:
While playing with sorting the unzip archive entries I tried use of the
last example in http://dlang.org/phobos/std_algorithm.html#sort
std.algorithm.sort!("toLower(a.name) <
toLower(b.name)",std.algorithm.SwapStrategy.stable)(entries);
It was terribly sl
On Thursday, 19 April 2012 at 16:19:05 UTC, Brad Anderson wrote:
On Thu, Apr 19, 2012 at 7:25 AM, Christophe
wrote:
"Brad Anderson" , dans le message (digitalmars.D.learn:34902),
a écrit :
> Perhaps I'm just misunderstanding something about closures
> but
> the following code seems to behave
On 22.04.2012 5:43, Ali Çehreli wrote:
On 04/21/2012 04:24 PM, Jay Norwood wrote:
> While playing with sorting the unzip archive entries I tried use of the
> last example in http://dlang.org/phobos/std_algorithm.html#sort
>
> std.algorithm.sort!("toLower(a.name) <
> toLower(b.name)",std.algo
On Sunday, 22 April 2012 at 00:06:47 UTC, Adam D. Ruppe wrote:
Made the data member private.
But if the struct is in a separate module you get an error.
So you must write
T get() {
return this._notNullData;
}
alias get this;
instead
alias _notNullData this; /// this is subst
On 22.04.2012 4:28, bearophile wrote:
In the main D newsgroup I have seen the two recent threads regarding a
more precise GC in D. I have two questions about that, that seem more
fit for D.learn.
1) I have not fully understood the performance and memory implications
of the more precise GC. In th
On Sunday, 22 April 2012 at 00:06:47 UTC, Adam D. Ruppe wrote:
I just pushed an update to git with
a few changes people have suggested.
I removed one of the old opAssigns
to keep a static type check.
Added assumeNotNull and checkNotNull
as entry points.
Made the data member private.
I think
On Sunday, 22 April 2012 at 06:26:42 UTC, Jonathan M Davis wrote:
You can look at the code. It checks each of the characters in
place. Unlike
toLower, it doesn't need to generate a new string. But as far
as the
comparison goes, they're the same - hence that line in the docs.
- Jonathan M Dav
45 matches
Mail list logo