• 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

    • Mixxx 2.5.2 by Razvan Serea Mixxx is powerful, free, and open-source DJ software designed for both beginners and professionals. It offers real-time beatmatching, auto DJ, effects, and MIDI controller support. With a clean interface and compatibility across Windows, macOS, and Linux, Mixxx is ideal for live performances, radio broadcasts, or practice sessions. Its active community and constant updates make it a reliable tool for any DJ. Mixxx integrates the tools DJs need to perform creative live mixes with digital music files. Whether you are a new DJ with just a laptop or an experienced turntablist, Mixxx can support your style and techniques of mixing. Mixxx key features: Realtime audio engine with low-latency performance MIDI and HID controller mapping with customizable scripting (JavaScript-based) Vinyl DVS support (absolute & relative timecode modes) OpenSL, ASIO, WASAPI, and JACK audio backend support Advanced BPM & musical key detection (KeyFinder integration) Quantized beat sync and phase locking Effect chain routing with LADSPA plugin support 4-deck mixing with independent EQ and gain control Support for wide file formats (MP3, FLAC, OGG, WAV, AIFF) Broadcasting via Icecast and Shoutcast with metadata support Library with Crate, Playlist, and Smart Playlist organization Multi-core CPU support for performance optimization Microphone and Auxiliary input routing with talkover ducking OSC and Web MIDI support Skinnable and themable Qt-based UI Cue points, hotcues, and looping with quantization Recording in lossless WAV or compressed formats Clock-synced looping and beatjump Mixxx 2.5.2 changelog: Library Fix playlist export when name contains a dot Fix loading the wrong track via drag and drop when using symlinks Fix: byte order in hotcue comments imported from rekordbox Tracks table: show ReplayGain with max. 2 decimals, full precision in tooltip Fix keyboard mappings with non-ASCII characters on Linux Computer feature: enable initial sorting during population Computer feature: avoid false-positve 'has children' for non-directory links Fix column header mapping when using external library Fixed Single track cover reload on reload metadata from file Controller Mappings Arturia KeyLab Mk1: initial mapping Denon MC7000: slicer mode TypeError Denon MC7000: crossfader curve using wrong parameter DJ TechTools MIDI Fighter Twister: support 4 decks Hercules DJControl Inpulse 500: the crossfader was not reaching 100% to the right end Icon Pro Audio iControls: initial mapping Numark Mixtrack Platinium FX: Fix 4 steps browsing issue Traktor Kontrol S3: Use GUI config for settings Traktor S2 MK3: Fixed LED issue Traktor S4 MK2: Use engine settings API for configuration Traktor S4 MK3: prevent sync lockup, add setting for tempo center snap Controller Backend Control picker: Allow to learn MIDI Aux/Mic enable controls Make [Main],headSplit CO persistent across restart Fix MIDI Controller button learning Fix learning with "No Mapping" selected Unit tests for engine.beginTimer engine-api.d.ts: brake()/spinback() documentation Target support Fix building with a CMake multi-config setup Fix building with gcc >= 14 with LTO and clang >= 19 (fpclassify) Fix: gcc -Warray-bounds= in fidlib by using a flexible member Added Linux Mint Codenames to debian_buildenv.sh Add hidden [Config],notify_max_dbg_time setting to reduce warnings in developer mode Detect arch and fail early if not supported when installing buildenv Misc Vinyl Control: Reduce sticker drift Fix infinite number of pop ups of the "No Vinyl|Mic|Aux|Passthrough input configured" dialog Reduce CPU usage with Trace log messages Fix adjust Gain after adopting it as ReplayGain only in requesting playe Skins: add loop anchor toggle to Deere, Shade, Tango Sound Hardware preferences: add manual link for Mic monitoring modes Work around an Ubuntu, Ibus or Qt issue regarding detecting the current keyboard layout. Fix BPM rounding for the 3/2 case Update cue & play indicators on paused decks when switching cue mode Download: Mixxx 2.5.2 | 113.0 MB (Open Source) Links: Mixxx Home page | Other OSes | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • KDE brings Wayland PiP to Plasma 6.5, adds finishing touches to 6.4 as release nears by David Uzondu The KDE team has released its This Week in Plasma update, showing the final polish being applied to Plasma 6.4 ahead of its June 17 release. Last week, the KDE team brought performance upgrades, and this week the team is continuing that with improvements like faster loading for System Monitor components in Plasma 6.4. Future work for Plasma 6.5 is already underway, and it includes a feature that many have probably been waiting for: proper Picture-in-Picture support on Wayland. This uses an experimental version of the Wayland PiP protocol, which means applications like Firefox that also implement it can finally display PiP windows correctly. It is a long-overdue addition that moves the Wayland session closer to feature parity with X11. The devs also merged KWin's Background Contrast effect into the Blur effect. Virtual desktops can now be re-ordered from the Pager widget, a feature previously missing. Invert and Zoom settings have been moved into the Accessibility page, which is a more sensible place for them than the Desktop Effects page was. The team also brought consistency to the Breeze application style, with animated effects for checkboxes and radio buttons now working in QtQuick-based apps. Other small cleanups include standardizing the section headers in the Disks & Devices, Networks, and Bluetooth widgets. For those who do a lot of screen recording, Spectacle now makes it much clearer how to stop a recording, both in its notifications and shortcut names. As for the immediate future, Plasma 6.4 and its first point release are getting accessibility and user interface tweaks. The team improved text contrast for labels used in secondary roles throughout Plasma, making things like brightness indicators much easier to read. The Kicker Application Menu in 6.4 can now scroll horizontally when a search returns a ton of results, so you can actually see all of them. The team also delivered some stability improvements in Plasma 6.4.0, most notably fixing a long-standing issue where adding widgets to oversized panels could freeze the entire shell. Discover also got a much-needed fix for a crash that occurred when suggesting replacements for unsupported Flatpak apps. On the usability side, dragging files into a Folder View widget no longer causes glitchy visuals, and Open and Save dialogs from Flatpak-based browsers now properly allow the preview pane to open. Printing from Flatpak GTK apps now respects correct sizing, and installing or removing apps no longer wipes out your search input in Kicker or Kickoff while you're using it. Other notable fixes include: Selection rectangles on the desktop now render properly when using custom fonts or sizes (Plasma 6.3.6) A crash in System Monitor charts used by apps and Plasma components has been resolved (Frameworks 6.15) Switching process views in System Monitor no longer causes crashes (Frameworks 6.16) Open and Save dialogs no longer close when hovering over specific files (Frameworks 6.16) A thumbnailer crash on X11 caused by certain widget styles has been fixed (KDE Gear 25.04.3) Frameworks 6.15 also speeds up System Monitor by delaying tree view arrow loading There are still 3 high-priority Plasma bugs holding out, and the list of quick-win "15-minute bugs" has grown to 23.
    • Hasleo Backup Suite Free 5.4.2.0 by Razvan Serea Hasleo Backup Suite Free is a free Windows backup and restore software, which embeds backup, restore and cloning features, it is designed for Windows operating system users and can be used on both Windows PCs and Servers. The backup and restore feature of Hasleo Backup Suite can help you back up and restore the Windows operating systems, disks, partitions and files (folders) to protect the security of your Windows operating system and personal data. The cloning feature of Hasleo Backup Suite can help you migrate Windows to another disk, or easily upgrade a disk to an SSD or a larger capacity disk. System Backup & Restore / Disk/Partition Backup & Restore Backup Windows operating system and boot-related partitions, including user settings, drivers and applications installed in these partitions, which ensures that you can quickly restore your Windows operating system once it crashes. Viruses, power failure, or other unknown reasons may cause data loss, so it is a good habit to regularly back up the drive that stores important files, you can at least recover lost files from the backup image files in the event of a disaster. System Clone / Disk Clone / Partition Clone Migrate the Windows operating system from one disk to another SSD or larger disk without reinstalling Windows, applications and drivers. Clone entire disk to another disk and ensure that the contents of the source disk and the destination disk are exactly the same. Clone a partition completely to the specified location on the current disk or another disk and ensure that the data will not be changed. File Backup & Restore Back up specified files(folders) instead of the entire drive to another location to protect your data, so you can quickly restore files(folders) from the backup image files when needed. Incremental/Differential/Full Backup Different backup modes are supported, you can flexibly choose data protection schemes, which can improve backup performance and save storage space while ensuring data security. Delta Restore Delta restore uses advanced delta detection technology to check the changed blocks on the destination drive and restore only the changed blocks, so it has a faster restore speed than the traditional full restore. Universal Restore This feature can help us restore the Windows operating system to computers with different hardware and ensure that Windows can work normally without any hardware compatibility issues. Hasleo Backup Suite 5.4.2.0 changelog: Added backup image delete feature Added storage path management feature Improved file backup feature Show application notifications in Windows Notification Center Various other bug fixes and feature improvements Download: Hasleo Backup Suite 5.4.2.0 | 34.4 MB (Freeware) Links: Hasleo Backup Suite Website | Hasleo Backup Suite Guide | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • One Month Later
      5i3zi1 earned a badge
      One Month Later
    • Week One Done
      5i3zi1 earned a badge
      Week One Done
    • Week One Done
      julien02 earned a badge
      Week One Done
    • One Year In
      Drewidian1 earned a badge
      One Year In
    • Explorer
      Case_f went up a rank
      Explorer
  • Popular Contributors

    1. 1
      +primortal
      544
    2. 2
      ATLien_0
      227
    3. 3
      +FloatingFatMan
      160
    4. 4
      Michael Scrip
      113
    5. 5
      +Edouard
      102
  • Tell a friend

    Love Neowin? Tell a friend!