Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
It makes your code prettier with a simple modification of syntax but without a modification of the analogy between what your code says and what it actually does' date=' hence the name syntactical sugar.[/quote']By that logic, all higher level languages are "syntactical sugar". You could be the founding member of Xtreme Binary Talk! :D
  • Leaders
Posted
By that logic' date=' all higher level languages are "syntactical sugar". You could be the founding member of Xtreme Binary Talk! :D[/quote']

Not at all. I'll point out again that I make a distinction between something that performs an entirely new or significantly different function and something that is a minor syntax modification. The difference is, again, the analogy between what the code says and what it compiles to.

 

You have machine language and ASM. They are semantically very close. To describe the difference between the two as syntactical sugar wouldn't be entirely correct, though. The named commands are syntactical sugar (albeit very useful syntactical sugar). In that respect, a machine language coder with enough experience could equal an ASM programmer in terms of proficiency.

 

But ASM adds functional differences, such as labels, and new concepts like comments, modifying the analogy between the code that is written and the compiled result (I know, ASM and machine language aren't compiled).

 

Up at the next level, C abstracts the process of coding to the point that it no longer resembles simple computer commands but rather a logical process that is structured and modular as well as applicable to any CPU instead of a specific CPU, and adds more new functions and concepts, like structs and macros. C++ extends that with polymorphism, inheritance and encapsulation. And then VB abstracts things further, looking more like written sentences than computer code. None of those differences are syntactical suger. They don't decorate code. They change what it does and what it can do. They make code able to describe function with increasing brevity or simplicity as you reach higher level languages. Then there are .Net languages and Java, which compile for a natively object-oriented platform, and there are standard libraries for the majority of languages, which don't come close to syntactical sugar in any sense of the word.

 

On the other hand, operator overloading is functionally identical to creating a function to add or compare. It is merely cosmetic, and that is the essence of syntactical sugar.

[sIGPIC]e[/sIGPIC]
  • *Experts*
Posted

Whoa, Nellies! Funny Code was the topic - someone got sidetracked.

 

Let me sum it up: if you like operator overloading, use it. If you don't, don't. If you overload Equals on a reference type (class), I don't care - just don't come work for me :)

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Sorry, I didn't mean to hijack the thread.

 

I think there is still some discussion to be had about operator overloading so I've cranked up a new thread to continue that discussion and let this one get back on subject.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...