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
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) pushOwner(s)
s.options = gOptions s.options = gOptions
if sfOverriden in s.flags or s.name.s[0] == '=': semOverride(c, s, n) 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: if n.sons[bodyPos].kind != nkEmpty:
# for DLL generation it is annoying to check for sfImportc! # for DLL generation it is annoying to check for sfImportc!
if sfBorrow in s.flags: if sfBorrow in s.flags:

View file

@ -4,6 +4,9 @@ Special Operators
dot 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 Nim offers a special family of dot operators that can be used to
intercept and rewrite proc call and field access attempts, referring intercept and rewrite proc call and field access attempts, referring
to previously undeclared symbol names. They can be used to provide a to previously undeclared symbol names. They can be used to provide a

View file

@ -1,8 +1,6 @@
version 1.0 battle plan version 1.0 battle plan
======================= =======================
- overloading of `()` and ``.`` needs to be in .experimental
- implement ``.delegate`` for .experimental
- Deprecate ``immediate`` for templates and macros - Deprecate ``immediate`` for templates and macros
- fix generic multi-methods - fix generic multi-methods
- fix "high priority" bugs - 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 - 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 - find a solution for the x.f[T](y) gotcha
- implement ``.delegate`` for .experimental
- Destructors need to be refined. - Destructors need to be refined.
- annotation support for getType() - 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 See `https://github.com/nim-lang/Nim/issues/3898`_ for the relevant
discussion. discussion.
- Overloading the special operators ``.``, ``.()``, ``.=``, ``()`` now
should be enabled via ``{.experimental.}``.
Library Additions Library Additions