• 0

why the machine like syntax?


Question

Hi,

 

I have been programming for many years now. And I am damn good at it if I say so myself. But what I never liked in programming was the syntax we use. Why is that the compilers or the interpreters are designed to make use of {}, function etc... to distinguish between objects, functions, etc...

 

For example in JAVA you have:

class MyClass {
    String MyProp;
    Integer MyProTwo;
 
    public void hello(){
 
    }
}

Why can't we make JAVA, PHP or C++ compilers to compile or interpret syntaxes that are more elegant. For example:

class MyClass
    s:myprop
    i:myprotwo
    v:hello
          print "i'm awesome"
    end

Or

make class MyClass. Define properties myprop,myproptwo. Make function hello print "I'm awesome"

What I am aiming for is something what .NET has done. You can program .NET applications in C#, J#, C++ etc... Is it possible to have some kind of XSTL bridge, so we programmers can design our own programming syntax? :p

 

myownsynxtax -> XSTL Template -> Mapped to JAVA/C# Native syntax.

Link to comment
https://www.neowin.net/forum/topic/1162504-why-the-machine-like-syntax/
Share on other sites

21 answers to this question

Recommended Posts

  • 0

Because it adds a lot more structure to the code. I personally can't stand languages like VB because I feel like it's a lazy language. It lets you do things that I'd consider bad habit, but work perfectly fine if you do them right, like less structure, sloppy variable definitions, etc. Sure, if you do it right it works as well as anything else, but it's also easy to make a mistake that's hard to find if you ask me. But that's why there are several different languages, so you can choose what you like. If you don't like a more structured language, then don't use it. I learned programming with C and C++ though so like I said, I can't stand the more loosely structured languages, but that's just my opinion.

  • 0

Anything other than rigidly defined structures and keywords are prone to be ambiguous statements. We humans understand each other using natural language fairly well, but every word and combination of words (number of which is rising almost exponentially) still has numerous interpretations depending on context, experience and present circumstances. And so terrible misunderstandings happen, often to tragicomic extent. Even with the best learning techniques and complex actual AI machines would still fail to interpret things the right way and meanwhile waste resources on very complex AI operations. Long story short - if machines would become more human-like, they'd also err like humans.

 

And then - even with rigidly defined structures each language has many coding, naming, spacing and newline conventions that makes readability and reuse, among other things, a challenging affair. If anything, I'd ask for even more strict templates and removal of most conventions.

  • Like 3
  • 0

wrote code like that in turing.  Made it difficult to find where I went wrong with things, took a lot longer to debug.

Plus, it's a pain in the butt trying to read someone else's code when it's clear, let alone a big block of text.

  • 0

Some existing languages are very succint. Take a look at Python or F# for example. Here is the quicksort algorithm in F#:

let rec quicksort = function
   | [] -> []                         
   | first::rest -> 
        let smaller,larger = List.partition ((>=) first) rest 
        List.concat [quicksort2 smaller; [first]; quicksort2 larger]

It's in general not possible to automatically translate programming languages from one to the other because they express different concepts. C++ templates for example have no equivalent in any similar language. .NET allows for language interoperability because they all compile to a common intermediate representation (IL), but even then it's not always possible to decompile F# code to C# or vice-versa.

 

I find that succintness is not an ideal, it's more of a dial that can be turned too far in either direction. Too verbose (i.e. Visual Basic), and it gets tedious to filter out the redundant information. Too succint (i.e. Perl), and it becomes hard to understand what the code means. The C family of langages has been extremely popular because it hits a nice balance between the two.

  • Like 3
  • 0
  Quote
Why can't we make JAVA, PHP or C++ compilers to compile or interpret syntaxes that are more elegant. For example:
Well, for a start, they wouldn't be Java, PHP or C++ compilers.
 
There are languages that have a "looser" structure than C-style languages. Personally I don't much care for any of them, I like the structure/rules that define C-style languages.
  • 0
  On 02/07/2013 at 19:43, roosevelt said:

What I am aiming for is something what .NET has done. You can program .NET applications in C#, J#, C++ etc... Is it possible to have some kind of XSTL bridge, so we programmers can design our own programming syntax? :p

 

myownsynxtax -> XSTL Template -> Mapped to JAVA/C# Native syntax.

 

Go for it. You can always design your own language extensions, or make your own front-end to a compiler.

http://www.cs.cornell.edu/Projects/polyglot/

 

It's basically a source-to-source translation from one language (your creation) to Java:

your_language -> polyglot+your_extension -> pure Java

 

I have written extensions to the Java language before... added Java language support for singleton objects by adding an 'object' keyword, used instead of 'class' to make a class a singleton. Also added support for strong mobility, which is pretty cool.

You can change up the Java grammar completely, make it your own.

  • 0

{ ... } adds a new scope.  You can use that in any area actually and not just around a loop, function, or class.

 

For example:

function test() {
  System.out.println("New scope below!");
  {
     String y = "Test";
     System.out.println(y); //y is only accessible here
  }
  System.out.println(y); //Can't use y here!
}
  • 0
  On 02/07/2013 at 20:00, threetonesun said:

Just code in Python. :laugh:

 

My first thought when I saw the OP's first "more elegant" example was also "Python!" That said, I don't think that Python is as loose as the OP thinks programming languages should be.

  • 0

Work in python for a while, and you'll soon appreciate the braces!

There's only so many times you can start using an editor which uses tabs instead of spaces, only to be chasing a seemingly never-ending "IndentationError: unindent does not match any outer indentation level".

  • 0

I looked into Python and the syntaxes Python offers is just what I was looking for. I also noticed how dead simple Python makes to do certain things (e.g. reading, wrting files or connecting to db). However, in terms of reliabiity and time tested confidence... how good is Python? Java is quite strong, has years of reputation and I am confident it's not going away anytime soon if ever. How about Python... how strong is its community, development and the range of it's modules? I am pretty confident if I there is a feature that needs to be coded in JAVA, chances are its already done. Do you have the same level of confidence for Python?

 

I also looked into wxpython for the desktop GUI... but it choked on me right away. I want to use Python3, but wxpython doesn't seem to support Python 3 just yet. Kind of killed my dream of using the same language to make not just cross platform but web applications too :p

 

I wish JAVA syntaxes were like Python... life would be simpler. I am looking into Ruby as well... RoR already had me excited for a while but I abandoned it due to some of its missing features in compairson to CakePHP.

  • 0
  On 05/08/2013 at 19:20, Brian M said:

Work in python for a while, and you'll soon appreciate the braces!

There's only so many times you can start using an editor which uses tabs instead of spaces, only to be chasing a seemingly never-ending "IndentationError: unindent does not match any outer indentation level".

 

Worked in Python for a while, I now hate braces.

 

  On 13/08/2013 at 06:13, roosevelt said:

I looked into Python and the syntaxes Python offers is just what I was looking for. I also noticed how dead simple Python makes to do certain things (e.g. reading, wrting files or connecting to db). However, in terms of reliabiity and time tested confidence... how good is Python? Java is quite strong, has years of reputation and I am confident it's not going away anytime soon if ever. How about Python... how strong is its community, development and the range of it's modules? I am pretty confident if I there is a feature that needs to be coded in JAVA, chances are its already done. Do you have the same level of confidence for Python?

 

Strong. I'm actually more confident in Python's survival. Java is about 1,700 severe security exploits away from someone somewhere thinking, "Hmm, maybe we should stop using this.". For some reason the first 1,699 didn't phase anyone. In all honesty neither are going away anytime soon. You're safe with Python.

  • 0

Python has a very strong developer community and can definitely be considered mature. The official Python documentation is excellent, and many extremely useful modules ship with Python by default. If those do not suit your needs, you can find a wide variety of Python modules written by other developers.

 

On thing you should be aware of with Python is the difference between the 2.x and 3.x releases: they are intentionally incompatible. Code written for Python 2 likely will not run on Python 3 without some modification. That said, the changes are very well documented - including official documentation for porting Python 2 programs to Python 3 - and the rationale for the breakage is solid: consistency and scalability.

  • 0

By the way I am playing around with Jython... and this blew my mind:

 

from javax.swing import JFrame, JLabel

def show_message_as_window(msg):
    frame = JFrame(msg,
                   defaultCloseOperation=JFrame.EXIT_ON_CLOSE,
                   size=(100, 100),
                   visible=True)
    frame.contentPane.add(JLabel(msg))
    
show_message_as_window("testing...")

 

:o

  • 0

You try writing in AppleScript for a while and you'll love the braces, they tried making that language "easy to use" by using lots of English terms and structure (There's nouns and verbs), but because they've based it off an actual language rather than syntax, it feels like you're reading/writing a badly written novel.

  • 0
  On 13/08/2013 at 06:13, roosevelt said:

I looked into Python and the syntaxes Python offers is just what I was looking for. I also noticed how dead simple Python makes to do certain things (e.g. reading, wrting files or connecting to db). However, in terms of reliabiity and time tested confidence... how good is Python? Java is quite strong, has years of reputation and I am confident it's not going away anytime soon if ever. How about Python... how strong is its community, development and the range of it's modules? I am pretty confident if I there is a feature that needs to be coded in JAVA, chances are its already done. Do you have the same level of confidence for Python?

Python is very mature, although in general I think dynamic languages are on their way out. More and more you see statically typed languages offer the conciseness and productivity of dynamic languages, while offering the type safety, performance and tooling benefits of static typing, i.e. F# (.NET), Scala (Java), TypeScript (Web), Go (Native), Rust (Native), Cobra (.NET), etc.; to a certain extent C# and C++ since they both have limited type inference now (var/auto).

 

Since your original point of comparison was Java, you should note that Java is as verbose and inflexible as classic imperative/OO languages go; even in something relatively similar like C# it's often possible to express the same things in much less code, due to the more powerful type system, better designed libraries and more advanced language features. Overall I think there are much more significant factors than using braces to denote scope or having to prefix methods with their accessibility and return types.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Halo Studios is teasing a big reveal for the series this October by Pulasthi Ariyasinghe Halo Studios, formerly 343 Industries, is preparing to reveal what it has been working on since the release of Halo Infinite. Other than providing support for existing Halo works, like Master Chief Collection and Infinite, the Xbox first-party studio has been rather quiet about its next releases since 2021. In its monthly blog post on Halo Waypoint, the developer had a special section regarding its future plans and dropped a pretty heavy teaser about an October announcement. Just like at the 2024 Halo World Championship, this year, the studio is planning another special announcement for fans. "Over the past few weeks, there’s been a fair amount of speculation about when and where more details might emerge about any of the multiple projects Halo Studios is actively working on," says the studio. "We don’t usually comment on such matters, but this time we want to enter the chat and share a little more perspective for Halo fans who might be on the fence about whether to attend this year’s event." In October of last year, 343 Industries, the development team that has been making games in the series since Halo 4 in 2012, went through a major rebranding to become Halo Studios. While no exact details were given, alongside a teaser video, the studio said then that multiple projects were currently in development but are years away from being released. It also revealed last year that the Slipspace Engine it developed for Halo Infinite is also being left behind in favor of Unreal Engine 5. "Speculation is always fun, but if you want the official scoop on what Halo Studios has been working on, you won’t want to miss this year’s Halo World Championship," added the studio. "We really hope you’ll join us in Seattle this October!" The 2025 Halo World Championship is slated to take place on October 24 in Seattle. Halo will be turning 25 years old in 2026, and it's likely that a new game or a remaster project will be revealed during this event.
    • I enjoy using Discover Weekly. I have found new music using it. Just sometimes it goes off the rails and doesn't remember I don't like rap. I'm not sure this update is anything helpful, but I guess I'll try it if it comes to free accounts.
    • Yep, I got 250 mbps down / 50 mbps up on Qatar last week and about a 30 ms ping.
    • Here are all the new features added to Microsoft 365 Copilot in June 2025 by Usama Jawad Towards the end of each month, Microsoft publishes a roundup of the features that it added to some of its popular software in the previous four weeks. We have already talked about the new capabilities introduced in Excel and Teams during the month of June 2025, and now, it's time to talk about Microsoft 365 Copilot. We'll start off with admin-facing capabilities since there are only a few of them. For starters, the usage metrics for Copilot in the Copilot Analytics tool now have new prompt categories that give more insights as to how users are engaging with Copilot. This feature has just begun rolling out, but another enhancement to the usage metrics that is already available is dedicated statistics for intelligent meeting recaps. Finally, Microsoft 365 admins can now view and manage their inventory of agents and connectors and also have more granular control over costs and billing policies. On the user side of things, we have intelligent assistance in Copilot Chat, powered by ContextIQ. This layer of intelligence can scope prompts to internal (SharePoint, OneDrive) and external data sources, find files in the chat, and proactively offer relevant suggestions as you type. In the same vein, the Copilot mobile app is being updated so you can talk to the AI in a natural manner using your voice. In addition, users can also get access to deep reasoning agents such as Researcher and Analyst for more complex and research-oriented needs. The Create experience in the app is also being updated with the ability to generate stories and branded templates. Other interesting Copilot capabilities rolling out to Edge customers are the ability to prompt the AI through the search bar, access agents from within the browser, and take advantage of Copilot's impressive text summarization capabilities. That's not all though, other features in tow include: Enhancements to Copilot in Outlook: Schedule meetings through Copilot chat, summarization of email attachments, a new sidebar experience in the classic Outlook app, meeting preparation, and automated meeting invite creation Improved image generation and large file handling in Copilot Chat: More photorealistic image generation with better text depiction, ability to generate longer summaries from bigger files, and PDF scanning capabilities for insights Memory in Copilot: Copilot will now remember certain items from your conversation and you can modify or delete them Transferred calls summary with Copilot in Teams Phone: Generate a summary of a call and transfer it to a target New file extension for Copilot Pages: Copilot Pages will now have .page extension with an updated file icon Copilot Notebooks availability in OneNote: We already covered this in detail here Seamlessly add brand-approved images with Copilot in PowerPoint: Integration of Copilot with SharePoint Organization Asset Library (OAL) and Templafy asset libraries Explain formulas on the grid with Copilot in Excel: Self-explanatory, exactly what it says on the tin Expanded availability for the Microsoft 365 Copilot app: Availability of the Microsoft 365 Copilot app on Mac You can read more details about each of the aforementioned features here.
    • Damn, I blocked OldGuru a long time ago and you have to go and quote them so I have to read that creepy a$$ take. LOL Anyway 100% that dude can't find women that will have sex with him.
  • Recent Achievements

    • Week One Done
      dennis Nebeker earned a badge
      Week One Done
    • One Year In
      timothytoots earned a badge
      One Year In
    • One Month Later
      CHUNWEI earned a badge
      One Month Later
    • Week One Done
      TIGOSS earned a badge
      Week One Done
    • First Post
      henryj earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      464
    2. 2
      +FloatingFatMan
      193
    3. 3
      ATLien_0
      164
    4. 4
      Xenon
      78
    5. 5
      wakjak
      72
  • Tell a friend

    Love Neowin? Tell a friend!