Jump to page: 1 2
Thread overview
Is there a reason for default-int?
Dec 28, 2009
Simen kjaeraas
Dec 29, 2009
Phil Deets
Dec 29, 2009
Don
Dec 29, 2009
Ary Borenszweig
Dec 30, 2009
BCS
Dec 30, 2009
Don
Dec 31, 2009
Ary Borenszweig
Dec 31, 2009
BCS
Dec 29, 2009
Don
Dec 29, 2009
Simen kjaeraas
Dec 30, 2009
BCS
December 28, 2009
Apart from C legacy, is there a reason to assume anything we don't know what
is, is an int? Shouldn't the compiler instead say 'unknown type' or something
else that makes sense?

-- 
Simen
December 29, 2009
On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas <simen.kjaras@gmail.com> wrote:

> Apart from C legacy, is there a reason to assume anything we don't know what
> is, is an int? Shouldn't the compiler instead say 'unknown type' or something
> else that makes sense?
>

C++ abandoned default int. I think it would be best for D to do the same.

Just my 2ยข,
Phil Deets
December 29, 2009
Simen kjaeraas wrote:
> Apart from C legacy, is there a reason to assume anything we don't know what
> is, is an int? Shouldn't the compiler instead say 'unknown type' or something
> else that makes sense?
> 

There's now an Error type in the compiler. It's gradually filtering its way through the compiler.
December 29, 2009
Phil Deets wrote:
> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas <simen.kjaras@gmail.com> wrote:
> 
>> Apart from C legacy, is there a reason to assume anything we don't know what
>> is, is an int? Shouldn't the compiler instead say 'unknown type' or something
>> else that makes sense?
>>
> 
> C++ abandoned default int. I think it would be best for D to do the same.

D never had default int. When there's an error, the compiler just has to choose *some* type, so that it doesn't crash <g>.
December 29, 2009
Don wrote:
> Phil Deets wrote:
>> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas <simen.kjaras@gmail.com> wrote:
>>
>>> Apart from C legacy, is there a reason to assume anything we don't know what
>>> is, is an int? Shouldn't the compiler instead say 'unknown type' or something
>>> else that makes sense?
>>>
>>
>> C++ abandoned default int. I think it would be best for D to do the same.
> 
> D never had default int. When there's an error, the compiler just has to choose *some* type, so that it doesn't crash <g>.

It could be an Error type (that's not an alias for int type) that don't start to spit errors everywhere and instead just blocks all further errors on that type.
December 29, 2009
On Tue, 29 Dec 2009 07:37:42 +0100, Don <nospam@nospam.com> wrote:

> Simen kjaeraas wrote:
>> Apart from C legacy, is there a reason to assume anything we don't know what
>> is, is an int? Shouldn't the compiler instead say 'unknown type' or something
>> else that makes sense?
>>
>
> There's now an Error type in the compiler. It's gradually filtering its way through the compiler.

Great!

-- 
Simen
December 30, 2009
Hello Don,

> Simen kjaeraas wrote:
> 
>> Apart from C legacy, is there a reason to assume anything we don't
>> know
>> what
>> is, is an int? Shouldn't the compiler instead say 'unknown type' or
>> something
>> else that makes sense?
> There's now an Error type in the compiler. It's gradually filtering
> its way through the compiler.
> 

ok. Can we s/gradually/rapidly/ ?


December 30, 2009
Hello Ary,

> Don wrote:
> 
>> Phil Deets wrote:
>> 
>>> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
>>> <simen.kjaras@gmail.com> wrote:
>>> 
>>>> Apart from C legacy, is there a reason to assume anything we don't
>>>> know what
>>>> is, is an int? Shouldn't the compiler instead say 'unknown type' or
>>>> something
>>>> else that makes sense?
>>> C++ abandoned default int. I think it would be best for D to do the
>>> same.
>>> 
>> D never had default int. When there's an error, the compiler just has
>> to choose *some* type, so that it doesn't crash <g>.
>> 
> It could be an Error type (that's not an alias for int type) that
> don't start to spit errors everywhere and instead just blocks all
> further errors on that type.
> 

that poses an interesting question: what "type" does this this give?

int i;
char[] s;

int foo(int);
char[] foo(int,char[]);
int[] foo(char[],int);

auto whatType = foo(i ~ s, s);

i~s gives the error type but DMD could tell that as long as the other args are correct, the only foo that works returns a char[] so does the variable get the error type or char[]?


December 30, 2009
BCS wrote:
> Hello Ary,
> 
>> Don wrote:
>>
>>> Phil Deets wrote:
>>>
>>>> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
>>>> <simen.kjaras@gmail.com> wrote:
>>>>
>>>>> Apart from C legacy, is there a reason to assume anything we don't
>>>>> know what
>>>>> is, is an int? Shouldn't the compiler instead say 'unknown type' or
>>>>> something
>>>>> else that makes sense?
>>>> C++ abandoned default int. I think it would be best for D to do the
>>>> same.
>>>>
>>> D never had default int. When there's an error, the compiler just has
>>> to choose *some* type, so that it doesn't crash <g>.
>>>
>> It could be an Error type (that's not an alias for int type) that
>> don't start to spit errors everywhere and instead just blocks all
>> further errors on that type.
>>
> 
> that poses an interesting question: what "type" does this this give?
> 
> int i;
> char[] s;
> 
> int foo(int);
> char[] foo(int,char[]);
> int[] foo(char[],int);
> 
> auto whatType = foo(i ~ s, s);
> 
> i~s gives the error type but DMD could tell that as long as the other args are correct, the only foo that works returns a char[] so does the variable get the error type or char[]?
> 
> 
Error.
December 31, 2009
Don wrote:
> BCS wrote:
>> Hello Ary,
>>
>>> Don wrote:
>>>
>>>> Phil Deets wrote:
>>>>
>>>>> On Mon, 28 Dec 2009 16:18:46 -0500, Simen kjaeraas
>>>>> <simen.kjaras@gmail.com> wrote:
>>>>>
>>>>>> Apart from C legacy, is there a reason to assume anything we don't
>>>>>> know what
>>>>>> is, is an int? Shouldn't the compiler instead say 'unknown type' or
>>>>>> something
>>>>>> else that makes sense?
>>>>> C++ abandoned default int. I think it would be best for D to do the
>>>>> same.
>>>>>
>>>> D never had default int. When there's an error, the compiler just has
>>>> to choose *some* type, so that it doesn't crash <g>.
>>>>
>>> It could be an Error type (that's not an alias for int type) that
>>> don't start to spit errors everywhere and instead just blocks all
>>> further errors on that type.
>>>
>>
>> that poses an interesting question: what "type" does this this give?
>>
>> int i;
>> char[] s;
>>
>> int foo(int);
>> char[] foo(int,char[]);
>> int[] foo(char[],int);
>>
>> auto whatType = foo(i ~ s, s);
>>
>> i~s gives the error type but DMD could tell that as long as the other args are correct, the only foo that works returns a char[] so does the variable get the error type or char[]?
>>
>>
> Error.

Exactly! You would get an error saying "i ~ s" cannot happen, then it resolves to the Error type. Now resolution of "foo" is not done (or yes: it defaults to Error) because it has an argument of type Error (one less error in the console is shown). Since foo is error, whatType is Error. Then if whatType is used it won't trigger errors. Etc.

You would get a single error in the precise position you need to correct it, instead of one error hidden with other many unrelated errors.
« First   ‹ Prev
1 2