Natural language style method declaration and usages in programming languages
2016-11-01 10:49
459 查看
More descriptive way to declare and use a method in programming languages
At present, in most programming language, a method is declared in few parts:keyword, method name, method parameters and return type etc.
E.g.
function int add(int a, int b) \\ The way to use it: int r = add(2, 3)
new way: Natural language style method declaration and usages in programming languages
idea
The idea is to split a method name into multiple parts, and put parameters before/between/after these name parts.Example 1:
function int (int a)add(int b) \\ usage: r = (2) add (3) \\ or r = 2 and 3
Example 2:
function void save(Employee employee)with(EmployeeSaveOptions options) \\ usage: save(employee)with(options) \\ or save employee with options
Example 2:
function (int a)add(int b) result is (return int) \\ usage: int r = (2) add (3) \\ or int r = 2 and 3 \\ or (2) add (3) result is int r
Explanation
For each parameter part, it may includes 0+ parameter(s).For return data type, we may use parameter style with a keyword return inside, e.g. result is (return (DataType))
Advantage
The new way makes code is more readable.相关文章推荐
- spaCy is a library for advanced natural language processing in Python and Cython:spaCy 工业级自然语言处理工具
- how to use a SQLite database in a standalone program with an HTML interface and VBScript as the programming language
- C语言中指针, 数组和字符串(Pointer, Array and String in C Programming Language)
- CodeProject: EasySize - Dialog resizing in no time!. Free source code and programming help
- Languages abbreviations in alphabetical order according to language
- Programming in C++, Rules and Recommendations
- Using and Programming Generics in J2SE 5.0
- Teddy's Aspect Weaver Version 0.3 with Great Updating and Fixing, Especially the Implementing of Getting Runtime Method Context Info and Method Arguments in MSIL Level
- CodeProject: Collapsible, resizable and dockable XP style control bar. Free source code and programming help
- (轉貼) Evolving a language in and for the real world C++ 1991-2006 (中文翻譯版) (By Bjarne Stroustrup) (C/C++)
- Bjarne新文章《Evolving a language in and for the real world: C++ 1991-2006》的读后感
- 说Hand-over-hand lock: 通读Concurrent Programming in Java: Design Principles and Patterns (1)
- IUIs and Web-Style Navigation in Windows Forms, Part 2
- Generics in the Java Programming Language Java
- 啃"创建线程"一章的疑难解析: 通读Concurrent Programming in Java: Design Principles and Patterns (2)
- The Ruby Way, Second Edition: Solutions and Techniques in Ruby, Programming (Paperback) 2nd.Edition.Oct.2006.eBook-BBL
- Programming in the Ruby language
- Thinking in Current Programming Languages
- Gene Expression Programming (GEP) in C# and .NET
- Styling Alert controls in Flex using the StyleManager class and setStyle() methods