Programming Language Features


as of know, i'm in process of designing/implementing own language right (and unless i'm mistaken, believe there's 2 others on these forums doing similar things). i'm curious, kinds of features have seen want see in new language, , kinds of tasks find tedious existing languages feel should easier? kinds of features should not present?

syntax not feature. language stored nothing more abstract syntax trees (it looks cryptic lisp if open file in text editor doesn't recognize language). users define syntax should be, , ast displayed syntax editor. when save, it's converted preferred syntax ast. should put end pointless style , syntax fights , force people think actual features, algorithms, , data structures.

ideas have:
- for-in loops, no loops. loops have potential logic mistakes made , no actual benefit on for-in loops.

- default values parameters.

- parameters can passed position or keyword.

- functions can take flags, in addition parameters. seen in command line programs i've never seen of languages i'm familiar with, i'll offer quick example of have in mind (with python style syntax):

code:
# defining function takes parameter (defaults 0) , flag.  def getcoordinates(offset: 0, :2d|3d):      if 2d:          return x, y      else:          return x, y, z    # calling function defined above:  x, y: getcoordinates(offset: 10, :2d)
- code must go in functions - can't have code outside of functions.

- functions must have documentation specifying intended input, output, exceptions occur, etc.

- no mandatory functions (ie, "main" in c , java). instead, when run code command line, specify function you're running, , pass parameters in if calling function within language. away argc/argv , nonsense of having parse them , write special usage messages , messages , whatnot. if user passes bad parameters, they're automatically shown documentation function.

- identifiers constants default - must explicitly made variables.

- language interpreted, checks of code done after it's changed ast before it's written disk. if don't have valid code, doesn't save (this in contrast python, don't find mistakes you've made until after you're running code. ide point issues out you, i'm under impression python code written in text editor - similarly, i'd language written in editor of choice, plugin text -> ast conversion checking.)

- named return values. python allows multiple return values, it's confusing each value is. example of have in mind:

code:
x: x, y: y: getcoordinates(:2d)
sets local constants x , y returned values named x , y. clarity which, assignment goes right left, so:

code:
localx: returnedx, localy: returnedy: getcoordinates(:2d)
of course wonder, why isn't datastructure being used? proper solution in cases - indeed, in above example, have type coordinate or point stores x , y, shared simplicity. guess better example might like:

code:
files: files, folders: folders: listcontents(path)
hopefully can imagine scenarios idea.

anyways... enough me. i'm interested in hearing kinds of features you've come across (or have never seen) you'd want new language have. i'm hearing think ideas.
 

this quite common in c apis, example open() system call. example, open file write only, , append on each write:

code:
open(path, o_wronly | o_append);
 


Forums Macs Mac Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

Comments

Popular posts from this blog

Pasco WA. Cops Killing A Homeless Man while running away

Gold Apple Watch Buyers to Get Special Purchasing Experience With 30 Minute Appointments

Transferring URLS