Coder Social home page Coder Social logo

oscript's Introduction

Oscript

This is a proposed object orient language. Java wouldn't be Java without out its OO paradiam. But one problem with Java is the fact that it is quite verbose. Oscript attempts to remedy this in a similar way how CoffeeScript tries to make Javascript more Javascript and less like Java syntax. Below shows how a class would be declared in Oscript with its Java quivalent.

	type Rocket {
    	float fuelVol; 
        String name; 
        public static float consumeRate = 42f;
        
    	(String name) {
        	fuelVol = 0;
            this.name = name;
        }
        
        public:
          setFuel(float num) {
          	if(num > 0)
          		fuel = num;
          }
        
          getName() String return name;
          
          launch() {
          	while(sufficentFuel())
            	fuel -= 42f;
          }
          
          static main(String[] args) {
          	Rocket f9("Falcon 9 v1.2");
            f9.launch();
          }
        private:
        	sufficentFuel() boolean return (fuel-consumeRate) > 0;
        	
    }

VS.

    public class Rocket {
    	private float fuelVol;
		private String name;
        public static float consumeRate = 42f;
        	
        public Rocket(String name) {
        	fuelVol = 0;
            this.name = name;
        }
        
        public void setFuel(float num) {
        	if(num > 0)
          		fuel = num;
        } 
        
        public float getName() {
        	return name;
        }
        
        public void launch() {
          	while(sufficentFuel())
            	fuel -= 42f;
        }
        
        public static void main(String[] args) {
        	Rocket f9 = new Rocket("Falcon 9 v1.2");
            f9.launch();
        }
        
        private boolean sufficentFuel() {
        	return (fuel-consumeRate) > 0;
        }
    }

oscript's People

Contributors

kerlinmichel avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.