[Webkit-unassigned] [Bug 178978] Synthesize constructors for structs

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Oct 28 08:55:09 PDT 2017


https://bugs.webkit.org/show_bug.cgi?id=178978

Myles C. Maxfield <mmaxfield at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Add object literals and     |Synthesize constructors for
                   |array literals to WSL       |structs

--- Comment #1 from Myles C. Maxfield <mmaxfield at apple.com> ---
Object literals are a little tricky because of something like this:

struct Foo {
    int x;
}

struct Bar {
    uint x;
}

void func(Foo f) { ... }
void func(Bar f) { ... }

func({3});

This is a case where the contents of the object literal will participate in function overload resolution.

However, if the goal is simply to be able to specify the contents of a struct in a variable initializer, we don't actually need object literals; we can just synthesize a constructor for each struct which contains members for each field. This means that the author will have to state which type they are constructing, which means that the contents are not considered when performing function overload resolution (and function overload resolution is unchanged.

For arrays, you can't put a pointer or an array reference anywhere into an array, which means that variable initializers are no more powerful than regular assignments; therefore, we don't really need array literals.

Retitling.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20171028/9e36ff32/attachment.html>


More information about the webkit-unassigned mailing list