Lars T. Kyllingstad Wrote:
> I do agree that, if possible, the language should match how most people
> think. But in this case, it is impossible, because of templates. How
> would the following example work with T = int[3], if arrays worked the
> way you want?
>
> struct MyArray(T)
> {
import std.stdio;struct State { string s; string getString() { return s; } static State opCall(string s) { State ret; ret.s = s; return ret; }}void main() { auto s = State("adf"); pragma(msg, s.getString());}dmd Output: (line 14 is the pragma statement)struct.d(14): Error: variable s cannot
On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire wrote:
> import std.stdio;
>
> struct State {
> string s; string getString() { return s; } static State opCall(string
> s) {
> State ret;
> ret.s = s;
> return ret;
> }
> }
>
> void main() {
> auto s = State("adf");
> pragma(msg, s
Sorry about the html
On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire
wrote:
import std.stdio;
struct State {
string s; string getString() { return s; }
static State opCall(string s) {
State ret;
ret.s = s;
return ret;
On Friday 16 July 2010 02:46:48 Rory McGuire wrote:
> import std.stdio;
>
> struct State {
> string s; string getString() { return s; }
> static State opCall(string s) {
> State ret;
> ret.s = s;
> return ret;
> }
> }
>
> void main() {
> auto s = State("adf");
> pragma(msg, s.getS
On Fri, 16 Jul 2010 11:58:57 +0200, Lars T. Kyllingstad
wrote:
On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire wrote:
import std.stdio;
struct State {
string s; string getString() { return s; } static State opCall(string
s) {
State ret;
ret.s = s;
return ret;
}
}
void main()
On Fri, 16 Jul 2010 12:05:02 +0200, Jonathan M Davis
wrote:
On Friday 16 July 2010 02:46:48 Rory McGuire wrote:
import std.stdio;
struct State {
string s; string getString() { return s; }
static State opCall(string s) {
State ret;
ret.s = s;
return ret;
}
}
void main() {
auto
On Fri, 16 Jul 2010 12:12:38 +0200, Rory McGuire wrote:
> On Fri, 16 Jul 2010 11:58:57 +0200, Lars T. Kyllingstad
> wrote:
>
>> On Fri, 16 Jul 2010 11:46:48 +0200, Rory McGuire wrote:
>>
>>> import std.stdio;
>>>
>>> struct State {
>>> string s; string getString() { return s; } static State
>>
"strtr" wrote in message news:i1lro6$307...@digitalmars.com...
> == Quote from bearophile (bearophileh...@lycos.com)'s article
>> strtr:
>> > Not that the memory is really significant compared to the rest of my
>> > program,
>> > but I have a few fairly large arrays I use only in compile time and
On 16 July 2010 11:12, Heywood Floyd wrote:
> Lars T. Kyllingstad Wrote:
> (...)
>
> When we introduce templates, this should still work:
>
> struct MyArray(T){
> array[3] T a;
> }
>
> // Let's try
> T == array[11] int
>
> array[3] T a;
> array[3] (array[11] int) a;
> array[3] array[11] a;
> ar
Am 16.07.2010 11:12, schrieb Heywood Floyd:
Lars T. Kyllingstad Wrote:
I do agree that, if possible, the language should match how most people
think. But in this case, it is impossible, because of templates. How
would the following example work with T = int[3], if arrays worked the
way you wa
On 16 July 2010 20:11, Mafi wrote:
> Am 16.07.2010 11:12, schrieb Heywood Floyd:
>
> Lars T. Kyllingstad Wrote:
>>
>> I do agree that, if possible, the language should match how most people
>>> think. But in this case, it is impossible, because of templates. How
>>> would the following exampl
What's the difference between the (forbidden) multiple inheritance, and
multiple subtyping?
BTW, IMO the syntax of multiple subtyping is strange and ugly.
== Quote from Daniel Murphy (yebbl...@nospamgmail.com)'s article
> I think if you use enum instead of const/immutable the compiler is not meant
> to put them in the executable (it might anyway in some/all cases).
> eg.
> module main;
> enum CT_STRING = "int i=0;";
> void main(){
> mixin( CT_STRING
Mafi Wrote:
>
> I don't really like it. Of course the order of indices feels better but
> it breaks the rule of reading types from right to left. It also
> introduces more parenthesis and a new keyword into types (amongst const,
> immutable and delegate etc). Consider:
>shared array[3](con
Heywood Floyd:
> First of all, I definitely think that how arrays are declared now would have
> to stay just the way it is,
> no matter what. I don't think stuff like that is changeable this late in a
> language.
Recently I have suggested to remove the syntax:
new int[20];
And allow only:
new in
"strtr" wrote in message news:i1ql53$306...@digitalmars.com...
> == Quote from Daniel Murphy (yebbl...@nospamgmail.com)'s article
>> I think if you use enum instead of const/immutable the compiler is not
>> meant
>> to put them in the executable (it might anyway in some/all cases).
>> eg.
>> mod
Daniel Murphy wrote:
Sorry, I don't have D1 installed. Can you use enum to declare manifest
constants in D1 or is it a D2 thing?
It's a D2 thing. I believe the D1 way to do it is with static const.
If the string is left in the executable from
const char[] CT_STRING = "blah blah";
void mai
18 matches
Mail list logo