Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 7722 - Refuse normal functions to be used as properties #817

Merged
merged 3 commits into from
Mar 20, 2012

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Mar 19, 2012

http://d.puremagic.com/issues/show_bug.cgi?id=7722

Enforce @Property syntax for UFCS by -property switch.

@WalterBright
Copy link
Member

Why the enhancement to allow a property function to have two arguments? This isn't in the bug report. Is there a discussion on it?

@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 20, 2012

With UFCS, a property setting e1.prop = ev is rewritten to .prop(e1, ev). If the compiler disallows a property function with two arguments, we cannot set @ property attribute to .prop function, but -property switch enforce to .prop that has @ property. After all, we can never use such a syntax.
The alternate way is to stop property enforcement for the UFCS setter that needs two arguments.
Indeed, it is debatable.

WalterBright added a commit that referenced this pull request Mar 20, 2012
Issue 7722 - Refuse normal functions to be used as properties
@WalterBright WalterBright merged commit a57a29c into dlang:master Mar 20, 2012
@WalterBright
Copy link
Member

This gets a bus error compiling libphobos.a on OSX in 32 bit mode.

~/cbx/mars/dmd -I../druntime/import -w -d -property -m32 -O -release -nofloat -
lib -ofgenerated/osx/release/32/libphobos2.a ../druntime/lib/libdruntime-osx32.a
crc32.d std/algorithm.d std/array.d std/ascii.d std/base64.d std/bigint.d std/b
itmanip.d std/compiler.d std/complex.d std/concurrency.d std/container.d std/con
tracts.d std/conv.d std/cpuid.d std/cstream.d std/ctype.d std/csv.d std/date.d s
td/datetime.d std/datebase.d std/dateparse.d std/demangle.d std/encoding.d std/e
xception.d std/file.d std/format.d std/functional.d std/getopt.d std/gregorian.d
std/json.d std/loader.d std/math.d std/mathspecial.d std/md5.d std/metastrings.
d std/mmfile.d std/numeric.d std/outbuffer.d std/parallelism.d std/path.d std/pe
rf.d std/process.d std/random.d std/range.d std/regex.d std/regexp.d std/signals
.d std/socket.d std/socketstream.d std/stdint.d std/stdio.d std/stdiobase.d std/
stream.d std/string.d std/syserror.d std/system.d std/traits.d std/typecons.d st
d/typetuple.d std/uni.d std/uri.d std/utf.d std/variant.d std/xml.d std/zip.d st
d/zlib.d std/c/linux/linux.d std/c/linux/socket.d etc/c/curl.d etc/c/sqlite3.d e
tc/c/zlib.d std/c/fenv.d std/c/locale.d std/c/math.d std/c/process.d std/c/stdar
g.d std/c/stddef.d std/c/stdio.d std/c/stdlib.d std/c/string.d std/c/time.d std/
c/wcharh.d std/internal/math/biguintcore.d std/internal/math/biguintnoasm.d std/
internal/math/biguintx86.d std/internal/math/gammafunction.d std/internal/math/e
rrorfunction.d std/internal/processinit.d std/internal/uni.d std/internal/uni_ta
b.d std/net/isemail.d std/net/curl.d generated/osx/release/32/etc/c/zlib/adler32
.o generated/osx/release/32/etc/c/zlib/compress.o generated/osx/release/32/etc/c
/zlib/crc32.o generated/osx/release/32/etc/c/zlib/deflate.o generated/osx/releas
e/32/etc/c/zlib/gzclose.o generated/osx/release/32/etc/c/zlib/gzlib.o generated/
osx/release/32/etc/c/zlib/gzread.o generated/osx/release/32/etc/c/zlib/gzwrite.o
generated/osx/release/32/etc/c/zlib/infback.o generated/osx/release/32/etc/c/zl
ib/inffast.o generated/osx/release/32/etc/c/zlib/inflate.o generated/osx/release
/32/etc/c/zlib/inftrees.o generated/osx/release/32/etc/c/zlib/trees.o generated/
osx/release/32/etc/c/zlib/uncompr.o generated/osx/release/32/etc/c/zlib/zutil.o
std.contracts has been scheduled for deprecation. Please use std.exception inste
ad.
Notice: As of Phobos 2.058, std.ctype has been deprecated. It will be removed in
August 2012. Please use std.ascii instead.
Notice: As of Phobos 2.055, std.date and std.dateparse have been deprecated. The
y will be removed in March 2012. Please use std.datetime instead.
Notice: As of Phobos 2.055, std.gregorian has been deprecated. It will be remove
d in March 2012. Please use std.datetime instead.
std.perf has been scheduled for deprecation. Please use std.datetime instead.
Notice: As of Phobos 2.055, std.regexp has been deprecated. It will be removed i
n March 2012. Please use std.regex instead.
make[2]: *** [generated/osx/release/32/libphobos2.a] Bus error: 10
make[1]: *** [release] Error 2
make: *** [targets] Error 2

@WalterBright
Copy link
Member

reverted for now. sigh.

@WalterBright
Copy link
Member

Uh, my fault. I'll try reverting the revert.

@WalterBright
Copy link
Member

Now it fails to build the library:

std/conv.d(244): Error: template std.conv.toImpl(T,S) if (isImplicitlyConvertibl
e!(S,T)) does not match any function template declaration

@WalterBright
Copy link
Member

reverted the revert of the revert.

@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 20, 2012

Please, please wait too early reverting.
First, this pull was succeeded in each platforms (recent result).
But pull tester doesn't support OS X, so please wait until auto tester really fail and record the error. Otherwise it is almost impossible to fix the real problem by me.

And this pull requires Phobos master (yesterday, I have pushed some changes adding @Property attribute directly into Phobos repository). If you see the error in your local, was Phobos in git master?

@9rnsr
Copy link
Contributor Author

9rnsr commented Mar 24, 2012

I've opened #830 as a dup of this pull.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants