Objects of type `string` are internally encoded as UTF-16. Byte arrays or spans can contain anything, including strings encoded as UTF-8 (or whatever encoding you like, or raw binary files, or random bytes). The new feature does exactly what's written in the blog post: if a string literal contains only UTF-8 characters and you assign it to a byte array or span, it gets encoded as UTF-8. It's just syntactical sugar.
This is a post about C#11 the language, not the framework or the runtime. It's only telling you about what the compiler does when it encounters some syntax. Under the hood, it probably calls some encoders from the standard library.
> if a string literal contains only UTF-8 characters and you assign it to a byte array or span, it gets encoded as UTF-8.
I write a bunch of C# for my job, but am far from an expert in the language. My reading of this statement is redundant, which means I feel sure it's trying to communicate something the authors thought was "obvious" and is not.
* A string literal - so, realistically some Unicode text, right? All the other encodings anybody was actually using can transliterate to Unicode, so, they are just Unicode (with a different encoding)
* contains only UTF-8 characters - UTF-8 is an encoding of Unicode, so, this just means Unicode again
I'm guessing actually C# can write something that's not Unicode in a String for some reason? But what that might be is unexplained:
Can you... emit arbitrary bytes? But how when your native encoding (UTF-16) isn't even byte oriented? What does that mean?
Maybe you can emit the rare Unicode "non-characters" like U+FFFF ? But, you can express those just fine in UTF-8 so who cares?
Or perhaps it's as simple as C# lets you write literals which are sequences of 16-bit code units but aren't UTF-16 ?
> The language will allow conversions between string constants and byte sequences where the text is converted into the equivalent UTF8 byte representation. Specifically the compiler will allow string_constant_to_UTF8_byte_representation_conversion - implicit conversions from string constants to byte[], Span<byte>, and ReadOnlySpan<byte>. A new bullet point will be added to the implicit conversions §10.2 section. This conversion is not a standard conversion §10.4.
What the "UTF-8 literals" feature is really about the conversion of strings to byte[] (and similar).
And more specifically the static initialisation of byte[]: initialising a byte[] from a string literal will store the UTF8 encoding of the literal as a bytes array and can be performed from static data (a bytes constant in the binary), before that you had to write the "new byte[]" with individual integral byte value by hand e.g.
I've got about three meetings in me on an average day before my batteries are exhausted and I am effectively done for the day.
When agile-ish processes use up on of those lives every day, that leaves very little slack before recurring customer statusing, actual troubleshooting, or an honest-to-god productive planning meeting wipes the counter out.
I suspect you could waste a lot less time if meetings required agendas distributed beforehand and minutes distributed afterwards, but absolutely no one does that, or would read such material if it was produced.
The people I know who call themselves effective altruists seem to have gone beyond any actual philanthropy at this point and just go on tirades about AI risk and the singularity.
We seem to be very worked up over a virtually unknown new C-replacement language that's more likely than not to fizzle and become yet another 0.1% also-ran.
I feel like people are less getting worked up over Hare itself, and more what it represents. It is very much a reactionary language, defined less by any grand new ideas or visions and more by rejection of things that many people see as valuable progress over the last few decades. It doesn't help that it is being pushed by an already highly notable and controversial figure. The language just happens to be a convenient vehicle for arguing about these engineering (and personal) values.
Working remotely is better than all of those things, iff you commit to doing things correctly and writing things down.
Doing things correctly would help if you were in the office too, but you can paper over the inefficiencies of doing things incorrectly by wasting more time on the backchannel communication face-to-face.
Having lunch with colleagues has nothing to do with 'backchannel communication'. Sometimes it's nice to hear about where we like to go camping, or what cities are nice to visit in their home countries, or ... nothing to do with work or shipping products.
No matter how 'correctly' you think you're doing things, you still haven't convinced me after over a decade of shipping products that online whiteboards are useful, or refuted any of my other points.
Nothing in all the years I worked offline in offices convinced me that whiteboards were particularly useful.
At least we eventually had high-resolution cameras in our smartphones so we could photograph them when people insisted on doing planning on whiteboards - more than once I've seen software architects lose days of work because the janitors were overzealous with their dusting.
Companies being paranoid about "losing control of employees" seems overblown. People (at these tech cos anyway) (on average) are very responsible as individuals and motivated to work and grow their careers.
It not obvious what carrot or stick motivates people to deliver. But there has to be a way to achieve what the team|org|company wants even with remote workers. As a company - clearly specify and quantify goals, regularly share metrics of progress, provide better tools for working and focus on the long-term.
I really dislike this when it feels forced and artificial.
Also there's a strong risk of doing some little employee-appreciation gesture that backfires and pisses people off. Most of them do, because it feels like the company has cheaped out, or worse, spent a shit-load of money on something that you hate and then expects you to be grateful about it.
Yeah it pisses me off when I've been squeezed for every drop for the whole project by some bozo manager, and then I'm also now forced to be forget and forgive all of that, and pretend to be happy, because of some awkward celebration, just becomes another ass kissing for the manager and salt in the wounds for me.
Corporate "celebrations" are anything but. They are just posturing and virtue signalling. Only on groups of teams in high-trust situations (e.g., a small military unit winning a tough battle) will you experience real celebrations. They won't even have to be planned; they'll just happen!
I very much think that the "give me money" model is a really good one.
There's this very odd strain of infantilization that runs through a lot of corporate office management, like they are trying to reward second-graders with a choice from the prize box if they collect enough gold stars, rather than dealing with fully-grown adults that have their own children.
I actually really agree with this too. It helps normalize comp across all life choices too. There are so many, some which people get salty about suggesting it's a form of "comp" .
For examples:
* I basically don't drink so anything that has alcohol as it's selling point is non-comp to me
* I'm not going to be a parent so why cant I have a sabbatical in place of parental leave?
* I basically don't get sick, and when I do I still manage to deliver decently. Why not pay me out sick days? I could just lie and take them, but why should I have to?
-* and before someone goes exclaiming "Privilege!" remember these are real life choices with costs borne in other areas of life -- for example the choice to not have children is going to be very expensive when I'm older and have to pay for everything that children do for free taking care of their elderly parents. It's not a pure privilege, but a temporal shift of cost/benefits. *-
All I can say is thank god most of the stuff I work against has the source published on Github, and most of the rest is in decompiler-friendly languages.
This leaves the completely inscrutable and mostly undocumented REST apis that I've got to trial-and-error at, and always ask whether I did something wrong, the other party made a breaking change, or its just a Tuesday and the infrastructure is derped up.