Jump to page: 1 216  
Page
Thread overview
new DIP47: Outlining member functions of aggregates
Sep 07, 2013
Walter Bright
Sep 07, 2013
Jos van Uden
Sep 07, 2013
Iain Buclaw
Sep 07, 2013
Adam D. Ruppe
Sep 07, 2013
Paolo Invernizzi
Sep 07, 2013
Walter Bright
Sep 07, 2013
Jos van Uden
Sep 07, 2013
deadalnix
Sep 07, 2013
H. S. Teoh
Sep 07, 2013
Dmitry Olshansky
Sep 07, 2013
Dmitry Olshansky
Sep 07, 2013
Timon Gehr
Sep 07, 2013
Jonas Drewsen
Sep 07, 2013
Iain Buclaw
Sep 07, 2013
Andrej Mitrovic
Sep 07, 2013
Walter Bright
Sep 07, 2013
Andrej Mitrovic
Sep 07, 2013
Walter Bright
Sep 07, 2013
Andrej Mitrovic
Sep 07, 2013
Andrej Mitrovic
Sep 07, 2013
Andrej Mitrovic
Sep 07, 2013
Andrej Mitrovic
Sep 08, 2013
Walter Bright
Sep 09, 2013
Meta
Sep 07, 2013
Maxim Fomin
Sep 07, 2013
Walter Bright
Sep 07, 2013
Maxim Fomin
Sep 07, 2013
Walter Bright
Sep 07, 2013
Adam D. Ruppe
Sep 07, 2013
Andrej Mitrovic
Sep 08, 2013
Daniel Murphy
Sep 08, 2013
Joakim
Sep 08, 2013
Brian Schott
Sep 08, 2013
Jonathan M Davis
Sep 08, 2013
Walter Bright
Sep 08, 2013
Peter Williams
Sep 08, 2013
Walter Bright
Sep 08, 2013
Paolo Invernizzi
Sep 09, 2013
Peter Williams
Sep 09, 2013
Volcz
Sep 08, 2013
dennis luehring
Sep 08, 2013
Iain Buclaw
Sep 08, 2013
dennis luehring
Sep 08, 2013
Iain Buclaw
Sep 08, 2013
dennis luehring
Sep 08, 2013
Jonathan M Davis
Sep 08, 2013
Jonathan M Davis
Sep 08, 2013
Dmitry Olshansky
Sep 10, 2013
Martin Nowak
Sep 08, 2013
Lionello Lunesu
Sep 08, 2013
Ramon
Sep 08, 2013
Brian Schott
Sep 08, 2013
Namespace
Sep 08, 2013
Michael
Sep 08, 2013
Tove
Sep 08, 2013
Tove
Sep 08, 2013
Simen Kjaeraas
Sep 08, 2013
Robert Schadek
Sep 08, 2013
nazriel
Sep 08, 2013
Michel Fortin
Sep 08, 2013
Andrej Mitrovic
Sep 08, 2013
deadalnix
Sep 08, 2013
Dicebot
Sep 09, 2013
Paulo Pinto
Sep 10, 2013
Walter Bright
Sep 10, 2013
Walter Bright
Sep 10, 2013
Michel Fortin
Sep 10, 2013
H. S. Teoh
Sep 08, 2013
Dmitry Olshansky
Sep 08, 2013
Ettienne Gilbert
Sep 08, 2013
Gary Willoughby
Sep 08, 2013
Dicebot
Sep 08, 2013
Dicebot
Sep 08, 2013
Gary Willoughby
Sep 08, 2013
Paulo Pinto
Sep 08, 2013
Dicebot
Sep 08, 2013
Gary Willoughby
Sep 08, 2013
Dicebot
Sep 09, 2013
H. S. Teoh
Sep 09, 2013
Dicebot
Sep 09, 2013
PauloPinto
Sep 09, 2013
H. S. Teoh
Sep 09, 2013
Paulo Pinto
Sep 08, 2013
QAston
Sep 09, 2013
Peter Williams
Sep 08, 2013
Simen Kjaeraas
Sep 08, 2013
Jesse Phillips
Sep 08, 2013
Andrej Mitrovic
Sep 09, 2013
Jesse Phillips
Sep 09, 2013
Manu
Sep 09, 2013
PauloPinto
Sep 09, 2013
Paolo Invernizzi
Sep 08, 2013
w0rp
Sep 09, 2013
Manu
Sep 09, 2013
deadalnix
Sep 09, 2013
FrogLegs
Sep 09, 2013
Ramon
Sep 09, 2013
Ramon
Sep 09, 2013
Jacob Carlborg
Sep 09, 2013
deadalnix
Sep 09, 2013
Manu
Sep 09, 2013
Jacob Carlborg
Sep 09, 2013
Daniel Murphy
Sep 09, 2013
Ettienne Gilbert
Sep 09, 2013
Ettienne Gilbert
Sep 10, 2013
Jacob Carlborg
Sep 10, 2013
Jacob Carlborg
Sep 09, 2013
Jonathan M Davis
Sep 09, 2013
Andrej Mitrovic
Sep 10, 2013
Jacob Carlborg
Sep 10, 2013
Jacob Carlborg
Sep 10, 2013
Andrej Mitrovic
Sep 09, 2013
Jesse Phillips
Sep 09, 2013
Gary Willoughby
Sep 11, 2013
Jesse Phillips
Sep 09, 2013
H. S. Teoh
Sep 09, 2013
Brian Schott
Sep 09, 2013
H. S. Teoh
Sep 10, 2013
H. S. Teoh
Sep 10, 2013
Dicebot
Sep 10, 2013
Andrej Mitrovic
Sep 10, 2013
Dicebot
Sep 16, 2013
Bruno Medeiros
Sep 09, 2013
Jacob Carlborg
Sep 09, 2013
sclytrack
Sep 09, 2013
Dicebot
Sep 09, 2013
jostly
Sep 10, 2013
Martin Nowak
Sep 10, 2013
Walter Bright
Sep 10, 2013
Timon Gehr
Sep 10, 2013
bearophile
Sep 10, 2013
Craig Dillabaugh
Sep 10, 2013
bearophile
Sep 10, 2013
Craig Dillabaugh
Sep 10, 2013
Dicebot
September 07, 2013
Outlining of member functions is the practice of placing the declaration of a member function in the struct/class/union, and placing the definition of it at global scope in the module or even in another module.

http://wiki.dlang.org/DIP47
September 07, 2013
On 7-9-2013 19:00, Walter Bright wrote:
> Outlining of member functions is the practice of placing the declaration of a member function in the struct/class/union, and placing the definition of it at global scope in the module or even in another module.
>
> http://wiki.dlang.org/DIP47


The problem is that it is optional, so when you're reading other people's
code you'll still have to deal with inline definitions, and you'll need
a decent editor (doesn't have to be an IDE, even basic editors like
notepad++ and editpad pro support code folding and function lists) to
easily read it.
September 07, 2013
07-Sep-2013 21:00, Walter Bright пишет:
> Outlining of member functions is the practice of placing the declaration
> of a member function in the struct/class/union, and placing the
> definition of it at global scope in the module or even in another module.
>
> http://wiki.dlang.org/DIP47

7. Outlined member function return types, parameter types, and function bodies have private access to the module where the aggregate is declared.

I understand why you may want this hack but it starts to smells real bad. Not only we haven't fixed bugs in our module system yet we introduce another kludge into it to support the C++ header + unknown set of files with implementations. Another twist in visibility/accessiblity lookup rules. I expect another wave of bugs regarding @safe/pure/etc. silently accepted for outlined functions and so on.

Now you can't know if a module implements all of stuff it declares or not. Or where it is implemented at all. I would rather restrict this feature w.r.t. where outlined methods can be defined - e.g. same module or in the same sub-package.

Accessibility rules should stay the same as they are now. In that setting if one wants to split methods across multiple file - fine, just declare them 'package' and put implementations deeper down the package tree.

TL;DR: DROP point 7, and describe how to use 'package' to split implementation across multiple files.

-- 
Dmitry Olshansky
September 07, 2013
On 7 September 2013 18:28, Jos van Uden <usenet@fwend.com> wrote:
> On 7-9-2013 19:00, Walter Bright wrote:
>>
>> Outlining of member functions is the practice of placing the declaration of a member function in the struct/class/union, and placing the definition of it at global scope in the module or even in another module.
>>
>> http://wiki.dlang.org/DIP47
>
>
>
> The problem is that it is optional, so when you're reading other people's code you'll still have to deal with inline definitions, and you'll need a decent editor (doesn't have to be an IDE, even basic editors like notepad++ and editpad pro support code folding and function lists) to easily read it.

There's no problem here then!


Only two points I'd add to that list are that outlined member
functions declared in external modules:
- Will error if the aggregate or member declaration is not found (eg:
member doesn't exist in aggregate or external module is not imported).
- Are mangled as if from the module where the aggregate member is declared.

Just clarifies some implementation detail.

-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';
September 07, 2013
On Saturday, 7 September 2013 at 17:28:42 UTC, Jos van Uden wrote:
> and you'll need a decent editor

Or just run dmd -H over it.
September 07, 2013
07-Sep-2013 22:01, Dmitry Olshansky пишет:
> 07-Sep-2013 21:00, Walter Bright пишет:
>> Outlining of member functions is the practice of placing the declaration
>> of a member function in the struct/class/union, and placing the
>> definition of it at global scope in the module or even in another module.
>>
>> http://wiki.dlang.org/DIP47
>

Not to mention poor motivation. A huge paragraph that basically states that some folks prefer IDEs to automatically fixup *this* kind of stuff and not *that* kind of stuff.

I could understand this feature can be very convenient in e.g. DDMD that is being converted from C++. Then this and other examples should be provided.

-- 
Dmitry Olshansky
September 07, 2013
On Saturday, 7 September 2013 at 17:28:42 UTC, Jos van Uden wrote:
> On 7-9-2013 19:00, Walter Bright wrote:
>> Outlining of member functions is the practice of placing the declaration of a member function in the struct/class/union, and placing the definition of it at global scope in the module or even in another module.
>>
>> http://wiki.dlang.org/DIP47
>
>
> The problem is that it is optional, so when you're reading other people's
> code you'll still have to deal with inline definitions, and you'll need
> a decent editor (doesn't have to be an IDE, even basic editors like
> notepad++ and editpad pro support code folding and function lists) to
> easily read it.

No pun intended, but having it as  _mandatory_ would be a little to much for people like me that don't like this proposal at all.

- Paolo Invernizzi
September 07, 2013
On Saturday, 7 September 2013 at 17:28:42 UTC, Jos van Uden wrote:
> On 7-9-2013 19:00, Walter Bright wrote:
>> Outlining of member functions is the practice of placing the declaration of a member function in the struct/class/union, and placing the definition of it at global scope in the module or even in another module.
>>
>> http://wiki.dlang.org/DIP47
>
>
> The problem is that it is optional, so when you're reading other people's
> code you'll still have to deal with inline definitions, and you'll need
> a decent editor (doesn't have to be an IDE, even basic editors like
> notepad++ and editpad pro support code folding and function lists) to
> easily read it.

So the problem is that you need a *basic* editor to make other people's code look like the way you like ?

I'd say this is awesome, and most of the time, you won't achieve that. Don't try to impose your religion to the world.
September 07, 2013
On 09/07/2013 07:00 PM, Walter Bright wrote:
> Outlining of member functions is the practice of placing the declaration
> of a member function in the struct/class/union, and placing the
> definition of it at global scope in the module or even in another module.
>
> http://wiki.dlang.org/DIP47

> Rationale:

I don't think that the official rationale should include 'readability', giving clear preference to one declaration style over the other.

> Semantics:

First of all, the DIP should address the following additional points:
- CTFE (under which circumstances is an outlined member function CTFE-able?)
- UDA's
- DDOC
- Auto return functions


> 1. Only member functions of aggregates at module scope can be outlined.

Why module scope? Why just member functions?


> 2. Types, parameter types, and pure/const/immutable/shared/nothrow attributes must match. This is necessary as they affect overloading and so are needed for correct selection of which declaration is being outlined.

Why would nothrow/pure affect overloading but @safe/static not?


> 3. Parameter names need not match.

OK. (But maybe it is better to require them to match if given in both places.)


> 4. If there is a default parameter value, it may only appear in the member function declaration.

Probably this is not too bad, but can't you just require the AST to match?


> 5. @safe/@trusted/@system, private/package/public/export access, linkage and storage classes are as set in the declaration, overriding any in effect for the definition.

Isn't the overriding just confusing for no reason?


> 6. Template member functions may not be outlined.

(This is included in point 1.)


> 7. Outlined member function return types, parameter types, and function bodies have private access to the module where the aggregate is declared.

The function names themselves are missing, and maybe you want the type-declaring module to have access to its private function bodies as well if it imports the implementing module. In any case, this is rather ugly. Why not use 'package' for this purpose and keep visibility rather simple? [1]



([1] Well, IMO 'protected' is quite hard to implement in a non-restrictive way in presence of compile-time reflection.)

September 07, 2013
> 3. Parameter names need not match.

I think we should be conservative and require that parameter names match. This will ensure that code will not break in the future if named parameter functionality is added to the language at some point.

« First   ‹ Prev
1 2 3 4 5 6 7 8 9 10 11