digitalmars.D.bugs - [Issue 4272] New: x.typeof syntax
- d-bugmail puremagic.com (29/29) Jun 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (10/10) Jun 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (10/10) Sep 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (11/11) Sep 14 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (15/17) Oct 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (13/24) Oct 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (11/14) Oct 06 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
- d-bugmail puremagic.com (14/25) Oct 07 2012 http://d.puremagic.com/issues/show_bug.cgi?id=4272
http://d.puremagic.com/issues/show_bug.cgi?id=4272 Summary: x.typeof syntax Product: D Version: future Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc A syntax like x.typeof can be considered. There are situations where you will need to parenthesize anyway, like: import std.stdio; void main() { int x = 1; float y = 1.5; writeln(typeid(typeof(x + y))); } You will have to write: (x + y).typeof But in many situations with this change you will be able to avoid the (). This syntax is more similar/uniform to the x.sizeof syntax too (that is sizeof(x) in C). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4272 Trass3r <mrmocool gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mrmocool gmx.de Then typeid should probably also be .typeid instead of typeid() -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4272 monarchdodra gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monarchdodra gmail.com *** Issue 8661 has been marked as a duplicate of this issue. *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272 Jonathan M Davis <jmdavisProg gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jmdavisProg gmx.com PDT --- typeof isn't a property or a function, unlike sizeof. It's like an is-expression, and I think that treating it like a property would be a mistake. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 14 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272 Nick Treleaven <ntrel-public yahoo.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ntrel-public yahoo.co.uk 06:22:10 PDT ---typeof isn't a property or a function, unlike sizeof. It's like an is-expression, and I think that treating it like a property would be a mistake.I think (x + y).typeof should not be allowed, use the existing syntax instead. However, x.typeof is a useful shorthand that helps cut down on nested brackets in is expressions and elsewhere. So I would allow both typeof(expression) and identifier.typeof to be used, but *not* expression.typeof. The type of an instance is a natural property of the instance IMO. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272 Maxim Fomin <maxim maxim-fomin.ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |maxim maxim-fomin.ru ---The problem is that UFCS was made to work with functions and typeof is not a function. Accepting identifier.typeof would result in questions about which identifiers are valid for this and what else works besides typeof with them. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------typeof isn't a property or a function, unlike sizeof. It's like an is-expression, and I think that treating it like a property would be a mistake.I think (x + y).typeof should not be allowed, use the existing syntax instead. However, x.typeof is a useful shorthand that helps cut down on nested brackets in is expressions and elsewhere. So I would allow both typeof(expression) and identifier.typeof to be used, but *not* expression.typeof. The type of an instance is a natural property of the instance IMO.
Oct 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272 10:28:49 PDT ---The problem is that UFCS was made to work with functions and typeof is not a function. Accepting identifier.typeof would result in questions about which identifiers are valid for this and what else works besides typeof with them.This is not to do with UFCS. There are already many built in properties like x.sizeof, x.init: http://dlang.org/property.html typeof fits nicely as a built in property, and helps cut down on nested brackets. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 06 2012
http://d.puremagic.com/issues/show_bug.cgi?id=4272 ---Typeof is not a property either. And it differs from all those properties which, given a type or expression, provide fundamental information about their types like size, default value, name, alignment. Typeof works in opposite direction - given some expression it gives its type. BTW, identifier is a primary expression (http://dlang.org/expression.html), so, making idenfier.typeof possible and expression.typeof not (as mentioned above), raises some questions. However, if typeof is made a property too, it would be logical and consistent. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------The problem is that UFCS was made to work with functions and typeof is not a function. Accepting identifier.typeof would result in questions about which identifiers are valid for this and what else works besides typeof with them.This is not to do with UFCS. There are already many built in properties like x.sizeof, x.init: http://dlang.org/property.html typeof fits nicely as a built in property, and helps cut down on nested brackets.
Oct 07 2012