design - Printing standard in raw implementations -


i'm making little toy stack-language, , revolving around central concept of bytecode, literally jvm.

one of opcodes want add in, print_var function, print value of local variable. question is, print function use? println(), or print()?

well really, it's not question of use, what standard in actual applications of process? systems designed print(), , println() function built around print() function, or both made hand-in-hand seperate things?

i'm taking @ java's printwriter source, used in system.out.println(), , defined follows:

public void println(boolean x) {     synchronized (lock) {         print(x);         println();     } } 

obviously java made print() function , based println() off of it. many other major languages that?

let's see:

long story short: can find both. implement you think works best requirements respectively approach in general. in other words: have @ other opcodes have/want implement , assess if more "convenience" (so have print , println), or if focus on providing "elementary building blocks" (then might provide print).

beyond that: keep in mind providing println() has 1 major advantage: user doesn't need worry different "new line" characters different operating systems.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -