Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
What’s the cringe? I just looked it up and Go does seem to have type inference just like C#.
What I find cringy is that neither of them has constants (var is mutable). -
Sugar6892yIndeed variable inference is there like mentioned in reply above. But every data type is following behind the variable name
func foo(x int) int {
return x
}
The syntax is like a hybrid python and Java or C# so it’s easy to get hands on per say but very awkward for me to read intuitively lol -
@Sugar it’s a more modern way I’d say.
See TS, Dart, Swift, Kotlin, for example, where types come at the end.
You’ll get used to it quickly and may find it better after some time. -
hjk10157312y@Sugar there are plenty of things to complain about in Go but I feel this is where you are the problem because you are set in your ways. It's like when they moved a button in your favourite program to the more logical place but now you feel you go wrong every time. Go is both consistent and has a good reason for it. I now find it actually exactly as how it is logically processed.
See the accepted answer here and the link to the blog in the comment for full background https://stackoverflow.com/questions...
@Lensflare what do you mean about no constants? There is const it's one of the few keywords go has. -
@Lensflare neither of them have const?
Golang has them: https://gobyexample.com/constants
C# has them: https://docs.microsoft.com/en-us/...
Edit: oh, people already said it. Sorry for repeating it.^^
Imo there is no language feature that C# doesn't have. -
Anyways, it's almost always done the way @12bitfloat wrote it.
You only really use var if you don't have a value for the variable you're defining. -
hjk10157312y@Sugar it's natural I do it too. Just realising it is enough. I'm sure you get used to it and come to hate other things. Like seriously lacking things you found in C++#.
Sometimes it feels like a scripting language but when you really start using it, you'll notice it's far from it and GC is just about the only thing provided, rest is manual labor -
@nitwhiz "imo there is no language feature that c# doesn’t have"
Try Swift or Kotlin and you will start to miss plenty of features in C#. 😄
* constants for arbitrary values and with type inference (like I mentioned)
* sum types
* powerful extensions (not just for methods and instances)
* conditional conformance
* type inference for type members
* opaque types
* actors
I don’t say C# needs all of this, but there are many languages with features that you and me don’t know about. Many of them are awesome. -
@Lensflare interesting! I really need to look into Kotlin, it's on my list for ages... :D
Java: String foo =“bar”;
C#: var foo = “bar”;
Go: var foo string = “bar”
I just started learning Go and I’ve been cringing since.
rant