Why is the readonly deprecated/removed? I thought this was an awesome idea to implement in a modern programming language. Is the static inference to weak with respect to detecting readonly or ?
brianWed 22 Jun 2011
The readonly keyword was nothing more than a shortcut for declaring a private setter which you can still do:
Int foo { private set }
Or if you can a "calculated field" that is only computed once than fixed:
once Int foo() { 4 + 6 }
Or if you want a true immutable field:
const Int foo := 10
So we didn't take away functionality, just removed the readonly keyword in favor of using explicit private set because the term readonly was confusing and not actually accurate. See topic 1369 for discussion.
kbilstedThu 23 Jun 2011
Ah ok. I thought there was a general mechanism, readonly, to enable to say that the content of the reference could not change
DanielFathThu 23 Jun 2011
I'm pretty sure that is const. Once used as field qualifier it means that the field can only be assigned in constructor and nowhere else. See Const field .
Entire class can even be const if all its fields are const or they are fields with no storage. See Const classes. Only thing that can't be declared const are parameters in functions/methods.
algonzalezTue 23 Aug 2011
I get the following error when the runtime is set to dotnet:
-->fan -version
System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
at System.String.InternalSubStringWithChecks (Unknown Source)
at System.String.Substring (Unknown Source)
at Fanx.Tools.Tool.verifyDlls (Tool.cs:178)
at Fanx.Tools.Tool.sysInit (Tool.cs:139)
Fantom Launcher
Copyright (c) 2006-2011, Brian Frank and Andy Frank
Licensed under the Academic Free License version 3.0
.NET Runtime:
clr.version: 2.0.50727.5662
sys.platform: win32-x86
sys.version: 1.0.59
I seems to work fine when the runtime is set to java.
brianWed 24 Aug 2011
Looking at the code in Tool.cs I am not sure how that would happen. Try nuking your lib/tmp directory and see if that resolves your issue.
algonzalezWed 24 Aug 2011
Thanks. Deleting the contents of lib/tmp seems to have solved my issue.
brian Thu 2 Jun 2011
Its been a few months and we were due - I have posted a new build and updated online docs.
There isn't really any huge new features, but there are hundreds of little enhancements and bug fixes.
JavaScript
Tons of enhancements to bring JavaScript more in par with Java runtime:
FWT
Lots of nice enhancements to FWT, many provided by the Xored team:
Breaking Changes
There shouldn't be any major breaking changes, but there a couple things to note:
readonly
keyword which was deprecated in last build is now unsupporteddom::Event
toDomEvent
to avoid collisions withfwt::Event
sys::Err
to subclass fromRuntimeException
Change Log
Build 1.0.59 (2 Jun 2011)
readonly
keywordsuper
only used with slot calloverride once
with arraytactics Thu 2 Jun 2011
Very awesome :)
kbilsted Wed 22 Jun 2011
Why is the
readonly
deprecated/removed? I thought this was an awesome idea to implement in a modern programming language. Is the static inference to weak with respect to detecting readonly or ?brian Wed 22 Jun 2011
The
readonly
keyword was nothing more than a shortcut for declaring a private setter which you can still do:Or if you can a "calculated field" that is only computed once than fixed:
Or if you want a true immutable field:
So we didn't take away functionality, just removed the
readonly
keyword in favor of using explicitprivate set
because the term readonly was confusing and not actually accurate. See topic 1369 for discussion.kbilsted Thu 23 Jun 2011
Ah ok. I thought there was a general mechanism, readonly, to enable to say that the content of the reference could not change
DanielFath Thu 23 Jun 2011
I'm pretty sure that is
const
. Once used as field qualifier it means that the field can only be assigned in constructor and nowhere else. See Const field .Entire class can even be
const
if all its fields areconst
or they are fields with no storage. See Const classes. Only thing that can't be declaredconst
are parameters in functions/methods.algonzalez Tue 23 Aug 2011
I get the following error when the runtime is set to dotnet:
I seems to work fine when the runtime is set to java.
brian Wed 24 Aug 2011
Looking at the code in Tool.cs I am not sure how that would happen. Try nuking your lib/tmp directory and see if that resolves your issue.
algonzalez Wed 24 Aug 2011
Thanks. Deleting the contents of lib/tmp seems to have solved my issue.