Re: Is it safe to use 'is' to compare types?

2016-03-10 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 10 March 2016 at 02:14:19 UTC, H. S. Teoh wrote: On Thu, Mar 10, 2016 at 01:33:41AM +, Yuxuan Shui via Digitalmars-d-learn wrote: [...] You can't rely on invoking the compiler to link these objects, because if you're using shared libraries, it will be the OS's dynamic

Re: Is it safe to use 'is' to compare types?

2016-03-09 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Mar 10, 2016 at 01:33:41AM +, Yuxuan Shui via Digitalmars-d-learn wrote: > On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote: > >On 03/09/2016 07:05 AM, Yuxuan Shui wrote: > > > >> Can we left TypeInfo symbol undefined in the shared libraries? i.e. > >> D compiler will

Re: Is it safe to use 'is' to compare types?

2016-03-09 Thread Yuxuan Shui via Digitalmars-d-learn
On Wednesday, 9 March 2016 at 22:26:38 UTC, Ali Çehreli wrote: On 03/09/2016 07:05 AM, Yuxuan Shui wrote: > Can we left TypeInfo symbol undefined in the shared libraries? i.e. D > compiler will strip out TypeInfo definition when creating .so. > (Alternatively, we can have TypeInfo always

Re: Is it safe to use 'is' to compare types?

2016-03-09 Thread Ali Çehreli via Digitalmars-d-learn
On 03/09/2016 07:05 AM, Yuxuan Shui wrote: > Can we left TypeInfo symbol undefined in the shared libraries? i.e. D > compiler will strip out TypeInfo definition when creating .so. > (Alternatively, we can have TypeInfo always undefined in .o, and > generate them in linking stage only when

Re: Is it safe to use 'is' to compare types?

2016-03-09 Thread Yuxuan Shui via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 23:13:32 UTC, Anon wrote: On Tuesday, 8 March 2016 at 20:26:04 UTC, Yuxuan Shui wrote: [...] [Note: I phrase my answer in terms of Linux shared libraries (*.so) because D doesn't actually have proper Windows DLL support yet. The same would apply to DLLs, it just

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Anon via Digitalmars-d-learn
On Tuesday, 8 March 2016 at 20:26:04 UTC, Yuxuan Shui wrote: On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/8/16 3:26 PM, Yuxuan Shui wrote: On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't understand why TypeInfo would

Re: Is it safe to use 'is' to compare types?

2016-03-08 Thread Yuxuan Shui via Digitalmars-d-learn
On Monday, 7 March 2016 at 16:13:45 UTC, Steven Schveighoffer wrote: On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: [...] Thanks for answering. But I still don't understand why TypeInfo would need to be allocated. Aren't typeid()

Re: Is it safe to use 'is' to compare types?

2016-03-07 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/4/16 4:30 PM, Yuxuan Shui wrote: On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: On 3/3/16 6:58 PM, Yuxuan Shui wrote: On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote: On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is

Re: Is it safe to use 'is' to compare types?

2016-03-04 Thread Yuxuan Shui via Digitalmars-d-learn
On Friday, 4 March 2016 at 15:18:55 UTC, Steven Schveighoffer wrote: On 3/3/16 6:58 PM, Yuxuan Shui wrote: On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote: On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is typeid(b) yield different results than

Re: Is it safe to use 'is' to compare types?

2016-03-04 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/3/16 6:58 PM, Yuxuan Shui wrote: On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote: On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is typeid(b) yield different results than typeid(a) == typeid(b)? No. Indeed, opEquals on TypeInfo just calls is

Re: Is it safe to use 'is' to compare types?

2016-03-03 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 3 March 2016 at 23:58:39 UTC, Yuxuan Shui wrote: On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote: On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is typeid(b) yield different results than typeid(a) == typeid(b)? No. Indeed, opEquals on

Re: Is it safe to use 'is' to compare types?

2016-03-03 Thread Yuxuan Shui via Digitalmars-d-learn
On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote: On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is typeid(b) yield different results than typeid(a) == typeid(b)? No. Indeed, opEquals on TypeInfo just calls is itself. But opEquals also has extra

Re: Is it safe to use 'is' to compare types?

2016-03-03 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote: Will typeid(a) is typeid(b) yield different results than typeid(a) == typeid(b)? No. Indeed, opEquals on TypeInfo just calls is itself.

Is it safe to use 'is' to compare types?

2016-03-03 Thread Yuxuan Shui via Digitalmars-d-learn
Will typeid(a) is typeid(b) yield different results than typeid(a) == typeid(b)?