26

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: _> My idea in that that in C# instead of readonly ref appeared a construction "readonly T x", which for structures (and only for them), assigned jit' - to do a call through ref (if structure big), or as usual - through a copy on a stack. We admit on an example of operation Collection <T>.IndexOf (readonly T x) where T: struct Without loss of compatibility with leaking fw, breakages  and the failure from verification il does not quit.

27

Re: New ref readonly in C# and IL

_>> My idea in that that in C# instead of readonly ref appeared a construction "readonly T x", which for structures (and only for them), assigned jit' - to do a call through ref (if structure big), or as usual - through a copy on a stack. We admit on an example of operation Collection <T>.IndexOf (readonly T x) where T: struct S> Without loss of compatibility with leaking fw, breakages  and the failure from verification il does not quit. Whence such passions? Even most toporno-hachnaja implementation which (theoretically) it is possible  using source codes  - to the compiler enough for each call IndexOf (readonly T x) to generate one more function with a type name "<rref> IndexOf (readonly ref T x)", for the verifier remains  pure il where all are caused without ref if the programmer directly did not tell that wants with ref, and remains only  jit that seeing that function has a second variant of a call and it is actual - to cause it.  anybody concerns with nothing.

28

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: S>> I do not understand, what for  to create the reference to an array if it is offered to it to return the link to an array cell or a field. S>> in that and sense that through the link it is possible to accept/return either that, or another in the uniform image directly in one method. _> All the same I do not understand in what a problem. It is possible all the same an example when the user will receive something unexpected? Unexpectedly is to lose control over possibility of explicit instructions of transmission under the link. If the compiler is suddenly  copy transmission through readonly ref char it does not turn out to transfer null terminated string. _> My idea in that that in C# instead of readonly ref appeared a construction "readonly T x", which for structures (and only for them), assigned jit' - to do a call through ref (if structure big), or as usual - through a copy on a stack. We admit on an example of operation Collection <T>.IndexOf (readonly T x) where T: struct _> For structures in size with the register - jit will create a copy - just as now. And for structures in weight in kilobyte - itself to put on a call ref as the parameter readonly for the user exchanges nothing, and performance benefits. _> and as now made ms - at a collection it is necessary to have two different methods IndexOf (T x) and IndexOf (readonly ref T x), and adding in structure pair of fields - it is necessary to sit down and think, whether the structure grew up enough to run under the project and to change bottlenecks all potentially on readonly ref manually. Yes, I like understood. And so, when we do not know, whether the structure transferred in parameter is copied, we not can to return this structure under the link. readonly ref int Min (readonly ref int a, readonly ref int b) {if (a <b) return ref a; return ref b;} the similar method with readonly T will be always simply obliged to return a copy.

29

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: S>> Without loss of compatibility with leaking fw, breakages  and the failure from verification il does not quit. _> whence such passions? Dynamic dispatch in any form - delegates, interfaces, DLR etc. Ton of restrictions of type of the prohibition on ref return together with async-methods. Implicit cast from ref T in ref readonly T and . If strongly it would be desirable - will be ref-like structs. With all restrictions ref T, .

30

Re: New ref readonly in C# and IL

S> the similar method with readonly T will be always simply obliged to return a copy. Something will seems to me that copyings anyway <= than them is now. We admit at the hypothetical compiler there is a function on one readonly: readonly T Min (readonly T a, readonly T b) {if (a. CompareTo (b) <= 0) return a; else return b;} Checks up the compiler that from an input to an output  "ref" is saved, makes also the simple version of function, and one more with input ref and with returned value ref. And if something hinders (for example return default (T)) - makes the version at which only one argument with ref, or only input with ref and returned value without ref. And there where it is necessary to cause function - it is necessary to select fastest of accessible signatures simply.

31

Re: New ref readonly in C# and IL

S> Dynamic dispatch in any form - delegates, interfaces, DLR etc. Ton of restrictions of type of the prohibition on ref return together with async-methods. Implicit cast from ref T in ref readonly T and . S> if strongly it would be desirable - will be ref-like structs. With all restrictions ref T, . It is all it is possible to support, but alas then it is necessary to have 3 methods of record - three as now with T x/ref T x/readonly ref T x, fourth mine - readonly T x with the compiler capable  3 remained. Thanks convinced, it was ceased to want really I surrender, and I slip under desktop from laughter representing as to it will learn the future programmers in the alternative Universe with "ref C#" On the one hand all new possibilities C# concerning structures to me are pleasant - often I work with the code from which it is necessary to squeeze out speed, and it is better when variants are, than when they are not present. With another, something is sensation that about 15 years ago, when.NET NET appeared, I considered that idea to divide types on reference and value is ingenious, especially after Java. And now after non-nullable references, possible interest to stackalloc operator for reference types, and all these ref return, it seems that authors of language desperately overcome a jamb of 15-year-old prescription

32

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: S>> Dynamic dispatch in any form - delegates, interfaces, DLR etc. Ton of restrictions of type of the prohibition on ref return together with async-methods. Implicit cast from ref T in ref readonly T and . S>> if strongly it would be desirable - will be ref-like structs. With all restrictions ref T, . _> It is all it is possible to support, but alas then it is necessary to have 3 methods of record - three as now with T x/ref T x/readonly ref T x, fourth mine - readonly T x with the compiler capable  3 remained. Thanks convinced, it was ceased to want really I surrender, and I slip under desktop from laughter representing as to it will learn the future programmers in the alternative Universe with "ref C#" All easier. For those structures which really demand transmission on ref, there will be a modifier ref struct and mandatory in T in parameters of methods. ref T are compatible with readonly ref T, i.e. more it is required nothing. _> On the one hand all new possibilities C# concerning structures are pleasant to me - often I work with the code from which it is necessary to squeeze out speed, and it is better when variants are, than when they are not present. You confuse/mix optimization possibility from outside  (including , , stackalloc, auto ref etc) and support from language of features which have been put in the first CLR. Now there is a systematic operation in the second direction, performance - by a residual principle. For high-grade  it is necessary to break many contracts offered regular CLI - time, to pass to AOT-compilation - two. Well and to have the heavy user inside MS which pushes the budget under all finishings - three. Last is not present, so while it is had net native + rudimentary AOT in net core 2.

33

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: _> something will seems To me that copyings anyway <= than them is now. We admit at the hypothetical compiler there is a function on one readonly: for small methods of type Min () ref it is not necessary. Them JIT .

34

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: _> something will seems To me that copyings anyway <= than them is now. We admit at the hypothetical compiler there is a function on one readonly: _> _> readonly T Min (readonly T a, readonly T b) _> {_> if (a. CompareTo (b) <= 0) _> return a; _> else _> return b; _>} _> _> Checks up the compiler that from an input to an output  "ref" is saved, makes also the simple version of function, and one more with input ref and with returned value ref. And if something hinders (for example return default (T)) - makes the version at which only one argument with ref, or only input with ref and returned value without ref. And there where it is necessary to cause function - it is necessary to select fastest of accessible signatures simply. Well, let's consider the specification of hypothetical language, whose hypothetical compiler at us is. And here such causing code var array = new [] {1, 2}; ref int min = Min (ref array [0], ref array [1]);//it is not assured for syntax array [0] = 100; Console. WriteLine (min); What that will be on an output according to the specification in a case when the compiler will use copies and when he will use references??? Whether the result will differ? And if we T have not int, and something really heavy... I.e. int - here actually X.

35

Re: New ref readonly in C# and IL

S> it is good, let's consider the specification of hypothetical language, whose hypothetical compiler at us is. And here such causing code S> S> var array = new [] {1, 2}; S> ref int min = Min (ref array [0], ref array [1]);//it is not assured for syntax S> array [0] = 100; S> Console. WriteLine (min); S> S> What that will be on an output according to the specification in a case when the compiler will use copies and when he will use references??? Whether the result will differ? So array here type T instead of "readonly T". The compiler turns out meeting Min (array [0], array [1]) can to make copying call only. However I already surrendered the Author: Sinix Date: 25.10 18:51, it is already better to have three methods to give structure on an input, than will guess what of them it is used when you write "more simple code"

36

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: S>> What that will be on an output according to the specification in a case when the compiler will use copies and when he will use references??? Whether the result will differ? _> so array here type T instead of "readonly T". The compiler turns out meeting Min (array [0], array [1]) can to make copying call only. However , readonly T is a warranty that the caused code cannot change the value transferred under the link. I.e. if we transfer array cells Min cannot change them under the link, even receiving the link. But could, if received ref int. _> I already surrendered the Author: Sinix Date: 25.10 18:51, it is already better to have three methods to give structure on an input, than will guess what of them it is used when you write "more simple code" Yes, the less than implicit manipulations with ambiguous result, the better.

37

Re: New ref readonly in C# and IL

Hello, Sinix, you wrote: S> P.S. Well and certainly, with great power comes to blow up also a new method all to devils where without it Covariance of arrays is time to forbid for beginning for a long time with the syntactic prohibition at least.

38

Re: New ref readonly in C# and IL

Hello, hi_octane, you wrote: _> The more they do different readonly the the impression is stronger that anybody from authors does not have background in a C ++ And the more I look at that as they try to make from C# not clear duck-bill of type With ++, the it is pleasant to me Scala more.

39

Re: New ref readonly in C# and IL

Hello, Sinix, you wrote: S> Now there is a systematic operation in the second direction, performance - by a residual principle. It is sad that on the residual. Java with its poor architecture left far forward. The MSEC hands over positions. S> for high-grade  it is necessary to break many contracts, Not so it is a lot of. And it to make a compilation key. Such things as covariance for arrays or plural delegates in practice are not used almost. I with pleasure would correct places where they are (if such generally is) and would receive more high performance. S> offered regular CLI - time to pass to AOT-compilation - two. What means to pass? And where it disappeared? NGEN nobody cancelled. And absolutely not clearly than here JIT hinders. At JIT even there are more than possibilities for optimization. Unless time has not enough. S> Well and to have the heavy user inside MS which pushes the budget under all finishings - three. Last is not present, so while it is had net native + rudimentary AOT in net core 2. Here is how it is necessary to the MSEC to bend, that it started to work on an exterior customer? People there it is necessary for them new and creative. That that was necessary was to do it is known still 10 years ago. When I all it told over me here many laughed. Now it even became obvious to the MSEC. But it is possible to wait as early as 10 years and  all in stuff.

40

Re: New ref readonly in C# and IL

Hello, VladD2, you wrote: VD> People there it is necessary for them new and creative. That that was necessary was to do it is known still 10 years ago. When I all it told over me here many laughed. Now it even became obvious to the MSEC. But it is possible to wait as early as 10 years and  all in stuff. On all remaining I will not make comments, only about "new and creative". It does not work so. Or old  which think, then do, or incessant  which are not repaired. If it would be desirable to argue - simply work couple of weeks with net core / the bound libraries. Like all it is excellent, but eternally there is one nuance... Type such (the library release breaks authorization in  other libraries from ms), such (dotnet command is not able in target platform), such (ef core the second year cannot work with default values - in basis the garbage is brought. And yes, it not a bug) or such (since May it is broken multitargeting in studio). It only for a week, and that not all. For couple of months of stablly three-four ten bugs runs. That is characteristic, in full fw similar mistakes both were not, and are not present (three times on a tree). Mysticism

41

Re: New ref readonly in C# and IL

Hello, Sinix, you wrote: S> on All remaining I will not make comments, only about "new and creative". It does not work so. Or old  which think, then do, or incessant  which are not repaired. Bosh it. Do not think a horse-radish. Therefore mold crutches. Make mistakes, are then typed knowledge and try to correct them. But here (!) Compatibility! S> if it would be desirable to argue - simply work couple of weeks with net core / the bound libraries. Like all it is excellent, but eternally there is one nuance... S> Type such (the library release breaks authorization in  other libraries from ms), such (dotnet command is not able in target platform), such (ef core the second year cannot work with default values - in basis the garbage is brought. And yes, it not a bug) or such (since May it is broken multitargeting in studio). It only for a week, and that not all. For couple of months of stablly three-four ten bugs runs. One nuance at them was initially. It also was called NIH. Instead of using scientific and other experience all of them tried to make something as at , but another. And is mandatory beaten by nails to Vindovs. Now  this policy it is obvious. And they like as on . But go all the same road. To me would like 10 % of their resources, I for would move also Dotnet would be the best product on light. And they chew snivels also such as you suggest, all  and only and is necessary.

42

Re: New ref readonly in C# and IL

Hello, VladD2, you wrote:... Well, here. Transited the next 10 years and my correctness would seem is obvious, but I again see one smilies. Well, ? Wait and further from the weather sea. Not to demand from the MSEC to do that that it is necessary to people? Let at them "the internal customer" appears.

43

Re: New ref readonly in C# and IL

Hello, VladD2, you wrote: VD> Well, here. Transited the next 10 years and my correctness would seem is obvious, but I again see one smilies. Well, ? Wait and further from the weather sea. Not to demand from the MSEC to do that that it is necessary to people? Let at them "the internal customer" appears. Vlad, without insults, but with you generally anything to consider . At you two points of view, your and obviously wrong. And so "obviously wrong" that you do not hear the interlocutor generally. Therefore to deliver a smilie easier and to agree, than to argue for the sake of dispute

44

Re: New ref readonly in C# and IL

Hello, VladD2, you wrote: VD> One nuance at them was initially. It also was called NIH. Instead of using scientific and other experience all of them tried to make something as at , but another. And is mandatory beaten by nails to Vindovs. Now  this policy it is obvious. And they like as on . But go all the same road. Smilies on this message show that times change, but people remain the same. That I told that to you 10 years ago for many became obvious though then too with smilies showered. Unfortunately, for you, not to correctness you are convinced of the, now, only when on pension quit. In 10 years of the MSEC to you will sell that over what you laughed today. The window of Overtona operates and not in the politician.

45

Re: New ref readonly in C# and IL

Hello, VladD2, you wrote: VD> Smilies on this message show that times change, but people remain the same. Not Vlad, times change, and Nemerle remains in the same place. VD> that I told that to you 10 years ago for many became obvious Show me your money.... <<RSDN@Home 1.0.0 alpha 5 rev. 0 on Windows 8 6.2.9200.0>>