From bea62bb63205101c6005fb80946e8193985667fd Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Fri, 22 Jul 2016 18:07:23 +0200 Subject: [PATCH] overloading of dot and parenthesis operators should now be done in .experimental --- compiler/semstmts.nim | 3 +++ doc/manual/special_ops.txt | 3 +++ todo.txt | 3 +-- web/news/version_0_15_released.rst | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 4c9191d12..79581e4cb 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -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: diff --git a/doc/manual/special_ops.txt b/doc/manual/special_ops.txt index 702693423..1c7136bec 100644 --- a/doc/manual/special_ops.txt +++ b/doc/manual/special_ops.txt @@ -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 diff --git a/todo.txt b/todo.txt index cede141ee..745daa7c7 100644 --- a/todo.txt +++ b/todo.txt @@ -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() diff --git a/web/news/version_0_15_released.rst b/web/news/version_0_15_released.rst index 80f178093..e16bdc9ae 100644 --- a/web/news/version_0_15_released.rst +++ b/web/news/version_0_15_released.rst @@ -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