Anton Kavalenka schrieb: > Florian Klaempfl wrote: >> I've continued to work on support of an unicodestring type in fpc. >> It's currently in an svn branch at: >> http://svn.freepascal.org/svn/fpc/branches/unicodestring >> and will be merged later to trunk. The unicodestring type is a ref. >> counted utf-16 string. On non-windows, widestring is mapped to this >> type. If you're interested in unicode support please test, give >> feedback here and submit fixes. >> >> An existing working copy of trunk can be switched to this branch by >> cd fpc >> svn switch http://svn.freepascal.org/svn/fpc/branches/unicodestring >> and back with >> svn switch http://svn.freepascal.org/svn/fpc/trunk >> _______________________________________________ >> fpc-devel maillist - fpc-devel@lists.freepascal.org >> http://lists.freepascal.org/mailman/listinfo/fpc-devel >> > The Pascal huge strings always annoy me. > Since - it is IMPLICIT automatic object with set of overloaded > methods, length and reference count fields etc hidden from developer. > > In near future we geat a Zoo of the strings: > AnsiString, WideString, UnicodeString, ShortString, PWideChar, PChar > Some of them with encoding field. > > Why not to make it EXPLICIT object > > s:=TCoolFPCString.Create('Test'); > s2:=TCoolFPCString.Create('Проверка'); //UTF8 encoded constant > s.asUtf8+=s2; > > SetWindowTextW(WinHandle,s.AsUnicodeString); // i explicitly say - get > me wide string and DO not any compiler magic > > if (s1.length=length(s2))... // generic runtime function length > returns the property of cool object > > s1.AcquireLock // prevent other threads acccess > s1.Clear; > s1.LoadFromResource(n_ReasourceId); // just use GNU gettext > s1.LoadTranslationFromResource(n_resID,'be_BY'); > s1.ReleaseLock // allow other thread access > > Anyway I just can subclass standard string and get a new functionality > with reachness of availabel fields and methods. > > > FPC supports operators - so there is lots of way to represent the > string, assign the string, load it from resource. > Make it thread-safe at implementation level but not at compiler level. > Standard string, unicode string , ansistring, widestring can be > implemented as wrappers along this object. > It seems like in mseGUI it is done. > > > > ------------------------------------------------------------------------ > > _______________________________________________ > fpc-devel maillist - fpc-devel@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-devel > I fully agree with you. I would like the object oriented way of strings also - but I stopped asking for that ;) There are a lot of advantages over the small amount of disadvantages. Of course I dont like this one:
S := TString.Create(''); But a built in class TString that is managed by the compiler. PS : Maybe i'm a littlebit more up to date about todays concepts of object oriented languages - maybe because I know him personally http://en.wikipedia.org/wiki/Bertrand_Meyer There were a lot of interesting discussions, etc... altough I dont like Eiffel :) and also this guy was one of my profs: http://en.wikipedia.org/wiki/Niklaus_Wirth greetings _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel