Hello Mike,
I want to do the following:
foreach(obj; list)
{
if(obj.pleaseKillMe)
somehow_remove_the_object_from_the_list();
}
That isn't legal for normal arrays or AAs. IIRC the docs even say that you
can't change what a foreach is iterating over during the foreach. I think
you will have to
I thought I understood ranges until I actually started trying to use
them. Now I'm having difficulties with the new range-based containers.
So I've got two issues right now, grokking ranges and understanding the
container interfaces.
Given an SList, I want to do the following:
foreach(obj; li
Hello Simen,
module a;
extern void foo( );
void bar( ) {
foo( );
}
module b;
import std.stdio;
void foo( ) {
writeln( "Hi!" );
}
The above does not work (Error 42: Symbol Undefined _D1a3fooFZv).
Adding extern to foo in module b ch
On Monday, June 28, 2010 17:51:09 Simen kjaeraas wrote:
>
> module a;
>
> extern void foo( );
>
> void bar( ) {
> foo( );
> }
>
> module b;
>
> import std.stdio;
>
> void foo( ) {
> writeln( "Hi!" );
> }
>
>
> The above d
On 29.06.2010 02:51, Simen kjaeraas wrote:
module a;
extern void foo( );
void bar( ) {
foo( );
}
module b;
import std.stdio;
void foo( ) {
writeln( "Hi!" );
}
The above does not work (Error 42: Symbol Undefined _D1a3f
module a;
extern void foo( );
void bar( ) {
foo( );
}
module b;
import std.stdio;
void foo( ) {
writeln( "Hi!" );
}
The above does not work (Error 42: Symbol Undefined _D1a3fooFZv). Adding
extern to foo in module b changes
On 27/06/10 1:03 PM, bearophile wrote:
Pierre Rouleau:
In what sense?
This is valid D1 code:
import std.stdio;
void main() {
string s = "this is
just
a
test";
writefln(s);
}
Bye,
bearophile
Thanks!
-- Pierre
On 29/06/2010 00:07, Simen kjaeraas wrote:
Maybe it's because you haven't added string to the setter? Just grasping
at straws here.
--
Simen
Hi Simen, yes, thats the prob. I just have not found the @property
docs.. thanks for all the help..
This snippet works now as expected.. D properties a
BLS wrote:
Hm, this snippet does not compile :
class Server {
private string _name, _id;
@property servername(string name) {
_name = name;
}
@property string servername() {
return _name;
}
}
remove string from @property
On 28/06/2010 23:00, Steven Schveighoffer wrote:
http://www.digitalmars.com/d/2.0/function.html#property-functions
-Steve
Makes sense :) thanks
On 28/06/2010 22:58, Steven Schveighoffer wrote:
I wasn't aware that @property implies auto. I guess that makes sense,
but I didn't consider it anything but a hint to the compiler about how
it could be called, not that did anything with the type.
Hm, this snippet does not compile :
class Serv
On 06/28/2010 03:58 PM, Steven Schveighoffer wrote:
On Mon, 28 Jun 2010 16:55:01 -0400, Ellery Newcomer
wrote:
On 06/28/2010 03:47 PM, Steven Schveighoffer wrote:
On Mon, 28 Jun 2010 16:37:06 -0400, BLS wrote:
@property nextServer() {
Shouldn't this be
@property Server nextServer() {
?
On Mon, 28 Jun 2010 16:55:44 -0400, Rory McGuire
wrote:
On Mon, 28 Jun 2010 22:37:06 +0200, BLS wrote:
beside, where are the @property docs ?
Only place I've seen @property docs is in TDPL
http://www.digitalmars.com/d/2.0/function.html#property-functions
-Steve
On 28/06/2010 22:47, Steven Schveighoffer wrote:
houldn't this be
@property Server nextServer() {
Ouch, you are right.. Interesting enough that @property nextServer() {
return ...} compiles without giving any error message..
Anyway it seems to be a forward reference bug. moving the inner Se
On 06/28/2010 03:47 PM, Steven Schveighoffer wrote:
On Mon, 28 Jun 2010 16:37:06 -0400, BLS wrote:
@property nextServer() {
Shouldn't this be
@property Server nextServer() {
???
auto functions?
On Mon, 28 Jun 2010 16:55:01 -0400, Ellery Newcomer
wrote:
On 06/28/2010 03:47 PM, Steven Schveighoffer wrote:
On Mon, 28 Jun 2010 16:37:06 -0400, BLS wrote:
@property nextServer() {
Shouldn't this be
@property Server nextServer() {
???
auto functions?
I wasn't aware that @proper
On Mon, 28 Jun 2010 22:37:06 +0200, BLS wrote:
Hi I have a forward reference pb in conjunction with @property.
Err msg is :
forward refrence to inferred return type of function call s1.servername.
any ideas ? beside, where are the @property docs ?
thanks, bjoern
final class LoadBalancer {
On 2010-06-28 15:48, BCS wrote:
Hello Jacob,
On 2010-06-28 02:28, BCS wrote:
One solution would be to have templates strip off const/immutable
from the top level of args.
[...]
This solution would match the proposal that popped up a while ago to
allow value assignment from const/immutable
On 28/06/2010 22:37, BLS wrote:
forward refrence to inferred return type of function call s1.servername.
any ideas ? beside, where are the @property docs ?
thanks, bjoern
ok moving the inner Server class (see prev. msg) in front of
LoadBalancer works.. seems to be a forward reference bug.
cl
On Mon, 28 Jun 2010 16:37:06 -0400, BLS wrote:
Hi I have a forward reference pb in conjunction with @property.
Err msg is :
forward refrence to inferred return type of function call s1.servername.
any ideas ? beside, where are the @property docs ?
thanks, bjoern
final class LoadBalancer {
BLS wrote:
Hi I have a forward reference pb in conjunction with @property.
Err msg is :
forward refrence to inferred return type of function call s1.servername.
any ideas ?
No line number? If so, file it in bugzilla. You might also want to file
a bug for the forward reference problems.
b
Hi I have a forward reference pb in conjunction with @property.
Err msg is :
forward refrence to inferred return type of function call s1.servername.
any ideas ? beside, where are the @property docs ?
thanks, bjoern
final class LoadBalancer {
private static LoadBalancer lb;
privat
On Mon, 28 Jun 2010 16:01:46 +0200, BCS wrote:
Hello Rory,
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud
wrote:
void main()
{
auto fun(string s) { return s;} // this does not compile
}
Hope this isn't a stupid question, but how would you access this
function
if it did work?
Would i
On Mon, 28 Jun 2010 16:07:43 +0200, Philippe Sigaud wrote:On Mon, Jun 28, 2010 at 15:40, Rory McGuire wrote:
void main()
{
auto fun(string s) { return s;} // this does not compile
}
Hope this isn't a stupid question, but how would you access this function if it di
Hi D users,
I created/tested a little logging class under DMD 1.062:
//-
//
// helper class for debugging/logging
//
import std.string;
import std.stdio;
scope class LogEnter
{
static int mIndent;
static char[] doindent
Hello Rory,
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud
wrote:
void main()
{
auto fun(string s) { return s;} // this does not compile
}
Hope this isn't a stupid question, but how would you access this
function
if it did work?
Would it be fun("asdf")?
Is this just shorthand for:
auto
On Mon, Jun 28, 2010 at 14:35, Steven Schveighoffer wrote:
> On Mon, 28 Jun 2010 08:14:12 -0400, Philippe Sigaud <
> philippe.sig...@gmail.com> wrote:
>
> On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg wrote:
>>
>> Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 /
>> UTF-32
>>
Hello Jacob,
On 2010-06-28 02:28, BCS wrote:
One solution would be to have templates strip off const/immutable
from the top level of args.
[...]
This solution would match the proposal that popped up a while ago to
allow value assignment from const/immutable to mutable.
I don't think I und
On Sun, 27 Jun 2010 17:17:25 +0200, Philippe Sigaud
wrote:
Is it defined somewhere that auto functions are not authorized inside
main?
void main()
{
auto fun(string s) { return s;} // this does not compile
}
error:
main.d|6|found 's' when expecting ')'|
main.d|6|semicolon expected, n
On 2010-06-28 14:14, Philippe Sigaud wrote:
On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg mailto:d...@me.com>> wrote:
Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 /
UTF-32 is managed was changed. "asd" is an array of immutable(dchar),
not imutable(char). At least DMD tells
On Mon, 28 Jun 2010 08:14:12 -0400, Philippe Sigaud
wrote:
On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg wrote:
Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 /
UTF-32
is managed was changed. "asd" is an array of immutable(dchar), not
imutable(char). At least DMD tel
On Mon, Jun 28, 2010 at 10:56, Jacob Carlborg wrote:
Something to keep in mind: as of 2.04x (.045? maybe), the way UTF-8 / UTF-32
is managed was changed. "asd" is an array of immutable(dchar), not
imutable(char). At least DMD tells me that its element type is 'dchar'.
So your function can be don
On Mon, 28 Jun 2010 11:09:13 +0200, Matthias Walter
wrote:
On 06/28/2010 09:49 AM, Justin Spahr-Summers wrote:
On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter
wrote:
Hi list,
I tried to write a traits class comparable to iterator_traits in C++
STL
or graph_traits in Boost Graph Lib
On 06/28/2010 09:49 AM, Justin Spahr-Summers wrote:
> On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter
> wrote:
>>
>> Hi list,
>>
>> I tried to write a traits class comparable to iterator_traits in C++ STL
>> or graph_traits in Boost Graph Library in D 2.0, but failed to do so via
>> template
On 2010-06-28 02:28, BCS wrote:
Hello Jacob,
That's annoying, specially since "char" is a value type. I would
preferably have a solution for both D1 and D2. Can I use a template to
cast/alias away the immutable part?
One solution would be to have templates strip off const/immutable from
the t
On 06/28/2010 05:32 AM, Simen kjaeraas wrote:
> Matthias Walter wrote:
>
>> Can I handle this in another way (like making the template a conditional
>> one)?
>
> Template constraints[1] sounds like what you want.
>
> Basically, you want the following:
>
> == Module a ==
> | module a;
> |
> | t
On Sun, 27 Jun 2010 18:51:35 +0200, Matthias Walter
wrote:
>
> Hi list,
>
> I tried to write a traits class comparable to iterator_traits in C++ STL
> or graph_traits in Boost Graph Library in D 2.0, but failed to do so via
> template specialization which is put into different modules. Putting
37 matches
Mail list logo