mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
destuctors are experimental; 'func' is now a keyword
This commit is contained in:
@@ -38,7 +38,7 @@ type
|
||||
tkConst, tkContinue, tkConverter,
|
||||
tkDefer, tkDiscard, tkDistinct, tkDiv, tkDo,
|
||||
tkElif, tkElse, tkEnd, tkEnum, tkExcept, tkExport,
|
||||
tkFinally, tkFor, tkFrom,
|
||||
tkFinally, tkFor, tkFrom, tkFunc,
|
||||
tkGeneric, tkIf, tkImport, tkIn, tkInclude, tkInterface,
|
||||
tkIs, tkIsnot, tkIterator,
|
||||
tkLet,
|
||||
@@ -75,9 +75,9 @@ const
|
||||
"const", "continue", "converter",
|
||||
"defer", "discard", "distinct", "div", "do",
|
||||
"elif", "else", "end", "enum", "except", "export",
|
||||
"finally", "for", "from", "generic", "if",
|
||||
"finally", "for", "from", "func", "generic", "if",
|
||||
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
||||
"let",
|
||||
"let",
|
||||
"macro", "method", "mixin", "mod",
|
||||
"nil", "not", "notin", "object", "of", "or",
|
||||
"out", "proc", "ptr", "raise", "ref", "return",
|
||||
|
||||
@@ -1026,7 +1026,10 @@ proc maybeAddResult(c: PContext, s: PSym, n: PNode) =
|
||||
|
||||
proc semOverride(c: PContext, s: PSym, n: PNode) =
|
||||
case s.name.s.normalize
|
||||
of "destroy": doDestructorStuff(c, s, n)
|
||||
of "destroy":
|
||||
doDestructorStuff(c, s, n)
|
||||
if not experimentalMode(c):
|
||||
localError n.info, "use the {.experimental.} pragma to enable destructors"
|
||||
of "deepcopy":
|
||||
if s.typ.len == 2 and
|
||||
s.typ.sons[1].skipTypes(abstractInst).kind in {tyRef, tyPtr} and
|
||||
|
||||
@@ -26,7 +26,7 @@ type
|
||||
wBind, wBlock, wBreak, wCase, wCast, wConst,
|
||||
wContinue, wConverter, wDefer, wDiscard, wDistinct, wDiv, wDo,
|
||||
wElif, wElse, wEnd, wEnum, wExcept, wExport,
|
||||
wFinally, wFor, wFrom, wGeneric, wIf, wImport, wIn,
|
||||
wFinally, wFor, wFrom, wFunc, wGeneric, wIf, wImport, wIn,
|
||||
wInclude, wInterface, wIs, wIsnot, wIterator, wLet,
|
||||
wMacro, wMethod, wMixin, wMod, wNil,
|
||||
wNot, wNotin, wObject, wOf, wOr, wOut, wProc, wPtr, wRaise, wRef, wReturn,
|
||||
@@ -106,7 +106,7 @@ const
|
||||
"const", "continue", "converter",
|
||||
"defer", "discard", "distinct", "div", "do",
|
||||
"elif", "else", "end", "enum", "except", "export",
|
||||
"finally", "for", "from", "generic", "if",
|
||||
"finally", "for", "from", "func", "generic", "if",
|
||||
"import", "in", "include", "interface", "is", "isnot", "iterator",
|
||||
"let",
|
||||
"macro", "method", "mixin", "mod", "nil", "not", "notin",
|
||||
|
||||
@@ -3,7 +3,7 @@ bind block break
|
||||
case cast const continue converter
|
||||
defer discard distinct div do
|
||||
elif else end enum except export
|
||||
finally for from
|
||||
finally for from func
|
||||
generic
|
||||
if import in include interface is isnot iterator
|
||||
let
|
||||
|
||||
@@ -50,7 +50,8 @@ const
|
||||
"break", "case", "cast", "const", "continue", "converter",
|
||||
"defer", "discard", "distinct", "div", "do",
|
||||
"elif", "else", "end", "enum", "except", "export",
|
||||
"finally", "for", "from", "generic", "if", "import", "in", "include",
|
||||
"finally", "for", "from", "func",
|
||||
"generic", "if", "import", "in", "include",
|
||||
"interface", "is", "isnot", "iterator", "let", "macro", "method",
|
||||
"mixin", "mod", "nil", "not", "notin", "object", "of", "or", "out", "proc",
|
||||
"ptr", "raise", "ref", "return", "shl", "shr", "static",
|
||||
|
||||
@@ -22,6 +22,8 @@ myobj destroyed
|
||||
'''
|
||||
"""
|
||||
|
||||
{.experimental.}
|
||||
|
||||
type
|
||||
TMyObj = object
|
||||
x, y: int
|
||||
|
||||
@@ -3,6 +3,8 @@ discard """
|
||||
errormsg: " usage of a type with a destructor in a non destructible context"
|
||||
"""
|
||||
|
||||
{.experimental.}
|
||||
|
||||
type
|
||||
TMyObj = object
|
||||
x, y: int
|
||||
|
||||
@@ -418,7 +418,7 @@ proc main(c: var TConfigData) =
|
||||
quit("[Error] cannot write file: " & outfile)
|
||||
removeFile(temp)
|
||||
copyDir("web/assets", "web/upload/assets")
|
||||
#buildJS("web/upload")
|
||||
buildJS("web/upload")
|
||||
buildNewsRss(c, "web/upload")
|
||||
#buildAddDoc(c, "web/upload")
|
||||
#buildDocSamples(c, "web/upload")
|
||||
|
||||
@@ -29,8 +29,11 @@ News
|
||||
- The "symmetric set difference" operator (``-+-``) never worked and has been
|
||||
removed.
|
||||
- ``defer`` is a keyword now.
|
||||
- ``func`` is a keyword now.
|
||||
- The ``using`` language feature now needs to be activated via the new
|
||||
``{.experimental.}`` pragma that enables experimental language features.
|
||||
- Destructors are now officially *experimental*.
|
||||
|
||||
|
||||
Language Additions
|
||||
------------------
|
||||
|
||||
Reference in New Issue
Block a user