Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

AnyLang Programming Language Comparison/Anylang Common Concepts

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

AnyLang Common Concepts The following is the central list of AnyLang Common Concepts. These are programming concepts that are common enough to be compared and applied across multiple mainstream programming languages. <td colspan="2">code blocks<td> block.case_ifconditional case statement block.catchcatch block block.diehow to terminate a process with error message block.elseelse statement block.else_ifelseif statement block.finallyfinally block block.ifif statement block.pausehow to pause the process block.qmark_ifternary qmark question mark conditional if statement block.quithow to terminate a process block.switchswitch statement block.trytry block block.try_catcha simple try-catch block <td colspan="2">code comments<td> codecmmt.beginenda generic begin-end multiline comment region codecmmt.docgendocgen tag codecmmt.multimulti-line cmmt codecmmt.singlesingle-line cmmt codecmmt.xregionmy_generic_region tag <td colspan="2">debugging operatinos<td> codedebug.loglogging errors and program info to a log file codedebug.testif statement used for debugging or example <td colspan="2">basic structural elements of code<td> codeelem.blockbare code block codeelem.end_codeend code codeelem.init_codeinit code codeelem.init_libinit library codeelem.init_varsinit vars codeelem.line_continline continuation for putting a newline in the middle of a statement (language dependent) codeelem.line_terminline termination character (e.g. semicolon) for languages that require it codeelem.named_blocknamed code block codeelem.new_doca new document codeelem.new_footera new footer within a document page codeelem.new_headera new header within a document page codeelem.new_liba new document as a library module (arbitrary defn of what constitutes a module) codeelem.new_pagea new page within a document (arbitrary defn of what constitutes a page) codeelem.new_reca new record entry <td colspan="2">looping structures<td> codeloop.arrloop over an array codeloop.dicenumerate or iterate over a the keys and values in a dictt codeloop.dirloop over items in a directory codeloop.foreachfor bar in foo codeloop.whilevarwhile loop with a variable codeloop.forvarold c-style loop( for icc=0; icc ~ foo.length; icc++ ) codeloop.lastloop control final iteration codeloop.modify_in_placeloop over an array (or iterable) and modify the elements in place codeloop.nextloop control, skip to the next iteration codeloop.rowsloop over rows in a SimpleTable codeloop.whilewhile statement <td colspan="2">metadata<td> codemeta.argscommand line arguments passed into current script codemeta.current_osget the current operating system that we are running under codemeta.docs_classself-documenting class codemeta.docs_funcself-documenting functions codemeta.docs_funcparamself-documenting function parameters codemeta.docs_methself-documenting methods codemeta.docs_methnamereturn the name of the currently running method codemeta.docs_methparamself-documenting method parameters codemeta.nameismaindetermine if source file is the current 'main' namespace [websearch://"python main trick"] codemeta.newdoca starting template for a new file in this language codemeta.quick_docshelp facility for language constructs codemeta.source_linethe current line in the current source file codemeta.source_paththe full path of the current source file currently running script path codemeta.source_pdirthe parent directory of the current source file. use path of the source file itself, and NOT the path of the file that calls it via *include* or *require* codemeta.versionthe language version of the current script or language interpreter <td colspan="2">source code regions<td> coderegion.detailsworksheet of an xregion metadata island coderegion.file_infofile info metadata island coderegion.generatorworksheet of an xregion metadata island coderegion.mainworksheet of an xregion metadata island coderegion.see_alsoworksheet of an xregion metadata island <td colspan="2">console operations<td> console.printprint to console console.printfformatted print to console console.printlnprint to console with newline <td colspan="2">data definitions and schemas<td> datadef.aohjust like perldsc AoH datadef.1yamlrecsmall yaml syntax datadef.2yamlrecmed yaml syntax datadef.3yamlrecbig yaml syntax datadef.newtablea new ReallySimpleData table datadef.newwkbka new ReallySimpleData wkbk datadef.newwksheeta new ReallySimpleData wksheet datadef.nvpSimpleNameValuePair datadef.simplerecSimpleRecord datadef.simpletablecreate a SimpleTable structure similar to perl AoH datadef.simpletable_ivcreate a SimpleTable structure similar to perl AoA (IV = IndexedValues) datadef.yamlrecSimpleRecord yaml syntax <td colspan="2">data processing operations<td> datamunge.json_mungedump a variable out to json and load it back in from json datamunge.dec_base_64decode base64 format datamunge.dec_htmlentdecode HTMLEnt format datamunge.dec_jscriptdecode jscript_url_style escaping datamunge.dec_rot_13decode rot13 format datamunge.enc_base_64encode base64 format datamunge.enc_htmlentencode HTMLEnt format datamunge.enc_jscriptencode jscript_url_style escaping datamunge.enc_rot_13encode rot13 format <td colspan="2">date and time operations<td> datetime.2date_fmtspecify a string like "Fri Sep 9 13.46.58 2005" (perl localtime() in scalar context) datetime.datecurrent system Date of the Month datetime.datemspecify a string like Fri 2005-08-26 13.23.03 (preferred) datetime.day_of_weekcurrent system Day of the week datetime.monthcurrent system Month datetime.nowcurrent system time and date datetime.time_millisecreturn the current time with millisecond accuracy (for timestamps) datetime.yearcurrent system Year <td colspan="2">error trapping and exceptions<td> error.arr_boundsarray index out of range error.dict_keyexdictionary key does not exist error.warningsenable or disable warnings <td colspan="2">filesystem operations<td> filesys.basenameget file basename from path filesys.copyCopy a file or directory filesys.deleteDelete a file or directory filesys.deltreedelete a directory tree filesys.dir_existstrue if a directory exists filesys.extenget file extension from full path filesys.file_existstrue if a file exists filesys.file_sizereturn file size as an integer (usu in bytes) filesys.loop_dirloop over files within a directory filesys.loop_treerecursively iterate files within a directory tree filesys.mkpathcreate directory even if there is more than one missing pathstep filesys.moveMove a file or directory filesys.parent_dirget file parent dir from a full path filesys.renameRename a file or directory <td colspan="2">function arguments<td> funcarg.arg_arrayspecify an array that holds multiple args funcarg.arrarray declare a function argument funcarg.booboolean declare a function argument funcarg.defvalspecify function parameters argument default value funcarg.intinteger declare a function argument funcarg.objobject declare a function argument funcarg.opt_argspecify an optional parameter funcarg.passfuncpass a function as an argument funcarg.passobjpass an object or dictionary that holds multiple args funcarg.req_argspecify a required parameter funcarg.strstring declare a function argument <td colspan="2">function definitions<td> funcdef.1funcsml syntax declare a function funcdef.1methsml syntax declare a oop_method funcdef.2funcmed syntax declare a function funcdef.2methmed syntax declare a oop_method funcdef.3funcbig syntax declare a function funcdef.3methbig syntax declare a oop_method funcdef.closurefunction as full-fledged closure funcdef.funcdefpsu funcdef template funcdef.funcdspfunction DspTemplate funcdef.funcmetaattach arbitrary metadata to a function funcdef.lambdafunction as python-lambda-style expression <td colspan="2">basic GUI display<td> guidsp.alertGuiAlert(sPrompt) alert box with ok button guidsp.buttongeneric pushbutton control guidsp.checkboxgeneric checkbox control same as html//inputCheckbox guidsp.combo_boxsame as html//Select execept user can also supply a value guidsp.date_timeA box that looks like a single-line edit control but instead accepts a date and/or time. A drop-down calendar is also provided guidsp.editsame as html//textarea guidsp.gridgrid and list control guidsp.group_boxA rectangular border/frame guidsp.hotkeyA box that looks like a single-line edit control but instead accepts a keyboard combination pressed by the user guidsp.input_boxstrVal = GuiInput(sPrompt guidsp.month_calA relatively tall control that displays all the days of the month in calendar format guidsp.passsimple input box for password same as html//inputPassword guidsp.picturean area containing a picture guidsp.progressprogress bar guidsp.radiogeneric radio button same as html//inputRadio guidsp.rangeup-down arrows to toggle through a range of integers guidsp.rich_editrich edit textbox with formatting guidsp.selectsame as html//Select guidsp.select_multisame as html//Select with multiple='true' guidsp.sliderA sliding bar that the user can move along a vertical or horizontal track guidsp.tabcontrol containing multiple pages guidsp.textsimple input box for text same as html//inputText <td colspan="2">GUI windows<td> guiwin.centercenter a window relative to the desktop (or parent window) guiwin.coordsspecify the position of a window relative to the desktop (or parent window) <td colspan="2">interoperability<td> interop.alt_interopdifferent alternatives for interop interop.com_objecthow to instantiante a msft OLE COM object interop.shell_runrun an external program e.g. ShellRun('notepad.exe') as a separate process interop.shell_runwaitrun external program and wait for it to finish <td colspan="2">code libraries and addons<td> lib.include_libinclude a library file lib.include_onceinclude a library file once <td colspan="2">OOP classes<td> oopclass.class_constructorconstructor method of a class oopclass.new_classa new OOP class oopclass.reflect_classnameget the name of a class from within the class itself <td colspan="2">OOP methods<td> oopmeth.aliascreate an alias name for an oop method oopmeth.filteriterate through the names of all selected methods of a class based on any criteria oopmeth.instancedeclare an instance method in a class oopmeth.invokeoperatorthe symbol used as the method invocation operator oopmeth.multileveldeclare and use a nested method (e.g., mymap.delaware.dover.getpopulation() ) oopmeth.reflectiterate through the names of all methods of a class oopmeth.staticdeclare a static method in a class oopmeth.symboliccall an oop method using a scalar for the methodname <td colspan="2">OOP objects<td> oopobj.new_instanceA new OOP plain object. Create an object (aka instance of a class). <td colspan="2">OOP references<td> oopref.symbolicinstantiate an object from an oop class using a scalar for the classname (without using string eval) <td colspan="2">regular expressions and related concepts<td> regex.22_notationspecify notation for individual characters char regex.backrefRegEx memorizing capture register inside match-region or substitute-region regex.basic_syntaxRegEx basic syntax basic_ops regex.capturespecify a capturing match register regex.matchRegEx match operation regex.noncapturespecify a non-capturing grouping match register regex.replaceRegEx replace operation <td colspan="2">SQL and related concepts<td> sqldata.bulk_insertpopulate a sql table using a text file as the raw data <td colspan="2">formatting and using strings in source code<td> strdsp.esc_bs1note regex22 is better strdsp.esc_bs2note regex22 is better strdsp.esc_qq1note regex22 is better strdsp.esc_qq2note regex22 is better strdsp.here_docspecify multi-line string inside code like a perl heredoc strdsp.here_funcheredoc function strdsp.here_strstring in variable strdsp.here_varinterpolated variable inside string strdsp.heredoc_indentheredoc indented along with the rest of the code strdsp.interpospecify a string variable with possible interpolation strdsp.number_formatpretty-format a number for locale or data display strdsp.printfspecify a string variable with special formatting options strdsp.skeleton_fillfill in the content of a SimpleTemplate strdsp.verbatimspecify a string variable with NO interpolation <td colspan="2">reserved for later use<td> system.timeoutthrow an exception or terminate process if it is taking too long <td colspan="2">templating<td> template.delimspecify the syntax for template delimiter template.valueofvalue output for template style programming <td colspan="2">data validation<td> valid.file_existtrue if a file exists in the filesystem valid.file_not_existtrue if a file does not exist in the filesystem valid.is_numericexpression evaluates to a number valid.is_stringexpression evaluates to a string valid.is_trueexpression evaluates to truth value <td colspan="2">variable declaration<td> vardec.myarrquickly declare array vardec.mybooquickly declare boolean vardec.mydicquickly declare dictionary vardec.myintquickly declare integer vardec.myobjquickly declare object vardec.mystrquickly declare string vardec.nullrepresent a null value in source <td colspan="2">working with variables<td> varops.array_assignassign a value to Array varops.array_decldeclare Array varops.array_initinitialize Array varops.composite_defndefine a composite variable (e.g., like with perl data structure cookbook) varops.composite_manipmanipulate a composite variable (e.g. sort, search filter view add edit delete) varops.dumperdump variable contents like with perl DataDumper varops.object_assignassign a value to Object varops.object_decldeclare Object varops.object_dupe_byrefshallow copy and duplicate an object or nested variable by reference varops.object_dupe_byvalcopy and duplicate an object or nested variable by value varops.object_initinitialize Object varops.scalar_assignassign a value to a scalar varops.scalar_decldeclare a scalar varops.scalar_initinitialize a scalar varops.typecastconvert the native type of a variable into another type varops.vartypeget the native type of a variable <td colspan="2">web and http<td> webhttp.htincludetransclusion include one page or page fragment into another webhttp.cflocationredirect to a new page like coldfusion cflocation webhttp.cgi_referrerclient referrer url webhttp.cgi_remoteaddrclient IP address webhttp.server_getgrab a web page from another site using serverside code