overloading of dot and parenthesis operators should now be done in .experimental

This commit is contained in:
Andreas Rumpf
2016-07-22 18:07:23 +02:00
parent fc0bb82802
commit bea62bb632
4 changed files with 9 additions and 2 deletions

View File

@@ -1252,6 +1252,9 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
pushOwner(s)
s.options = gOptions
if sfOverriden in s.flags or s.name.s[0] == '=': semOverride(c, s, n)
if s.name.s[0] in {'.', '('}:
if s.name.s in [".", ".()", ".=", "()"] and not experimentalMode(c):
message(n.info, warnDeprecated, "overloaded '.' and '()' operators are now .experimental; " & s.name.s)
if n.sons[bodyPos].kind != nkEmpty:
# for DLL generation it is annoying to check for sfImportc!
if sfBorrow in s.flags:

View File

@@ -4,6 +4,9 @@ Special Operators
dot operators
-------------
**Note**: Dot operators are still experimental and so need to be enabled
via ``{.experimental.}``.
Nim offers a special family of dot operators that can be used to
intercept and rewrite proc call and field access attempts, referring
to previously undeclared symbol names. They can be used to provide a

View File

@@ -1,8 +1,6 @@
version 1.0 battle plan
=======================
- overloading of `()` and ``.`` needs to be in .experimental
- implement ``.delegate`` for .experimental
- Deprecate ``immediate`` for templates and macros
- fix generic multi-methods
- fix "high priority" bugs
@@ -15,6 +13,7 @@ Not critical for 1.0
- get GC:v2 stable: nim c --gc:v2 -r -d:useSysAssert -d:useGcAssert -d:smokeCycles -d:useRealtimeGc tests/gc/gctest
- find a solution for the x.f[T](y) gotcha
- implement ``.delegate`` for .experimental
- Destructors need to be refined.
- annotation support for getType()

View File

@@ -28,6 +28,8 @@ Changes affecting backwards compatibility
See `https://github.com/nim-lang/Nim/issues/3898`_ for the relevant
discussion.
- Overloading the special operators ``.``, ``.()``, ``.=``, ``()`` now
should be enabled via ``{.experimental.}``.
Library Additions