PHP : Les Fondamentaux

Total Page:16

File Type:pdf, Size:1020Kb

PHP : Les Fondamentaux PHP : les fondamentaux Achref El Mouelhi Docteur de l’universite´ d’Aix-Marseille Chercheur en programmation par contrainte (IA) Ingenieur´ en genie´ logiciel [email protected] H & H: Research and Training 1 / 218 Plan 1 Introduction 2 Avant de commencer 3 Premier projet PHP 4 Commentaires 5 Variables 6 Quelques operations´ sur les variables 7 Fonctions utiles pour les chaˆınes de caracteres` H & H: Research and Training 2 / 218 Plan 8 Conditions et boucles if if ... else if ... elseif ... else switch Elvis operator Null coalescing while do ... while for 9 Tableaux Tableaux indexes´ Tableaux associatifs Tableaux multidimensionnels 10 Constantes H & H: Research and Training 3 / 218 Plan 11 Fonctions Fonctions nommees´ Fonctions anonymes Valeurs par defaut´ pour les parametres` Fonctions a` nombre indetermin´ e´ de parametres` Decomposition´ Passage par ref´ erence´ Fonction de retour (callback) Fonctions flech´ ees´ (Arrow functions) Typage de parametres` Typage de valeurs de retour Typage strict Type Nullable Fonctions gen´ eratrices´ H & H: Research and Training 4 / 218 Plan 12 Variables locales et globales 13 Math 14 Date 15 Fichiers Ouverture Fermeture Utilisation H & H: Research and Training 5 / 218 Introduction PHP PHP Initialement pour Personal Home Page ensuite pour PHP : Hypertext Preprocessor) langage de programmation open-source c oriente-objet´ et procedural´ imperatif´ interpret´ e´ faiblement type´ c Achref EL MOUELHI cre´e´ en 1994 par Rasmus Lerdorf dans le cadre d’un projet personnel pour gerer´ les visiteurs de son site web syntaxe tres` proche du C (procedural),´ C++ (procedural,´ oriente-objet)´ et Java (oriente-objet)´ H & H: Research and Training 6 / 218 Introduction PHP PHP, pourquoi ? Langage de haut niveau (pas de gestion de memoire,´ pas d’allocation dynamique, pas de pointeur... comme en c C et C++) Facile a` apprendre et a` utiliser Nombreuses documentations, supports videos,´ plusieurs exemples sur internet Enorme´ communautAchrefe´ : un EL des MOUELHI langages les plus utilises´ dans le monde c Permettant de developper´ rapidement des programmes portables : Windows, Mac OS, Linux... H & H: Research and Training 7 / 218 Quelques technologies concurrentes a` PHP JSP (Java Server Pages) : contenu dynamique ecrit´ en Java ASP.Net (Active Server Pages) : contenu dynamique pouvant etreˆ ecrit´ dans tous les langages de la plateforme .Net (C#, VB.Net...) Introduction Quel type d’application ? Applications utilisables en ligne de commande (scripting) La partie serveur pour applications web c applications mobiles sites web dynamiques Services web c Achref EL MOUELHI H & H: Research and Training 8 / 218 Introduction Quel type d’application ? Applications utilisables en ligne de commande (scripting) La partie serveur pour applications web c applications mobiles sites web dynamiques Services web Achref EL MOUELHI Quelques technologies c concurrentes a` PHP JSP (Java Server Pages) : contenu dynamique ecrit´ en Java ASP.Net (Active Server Pages) : contenu dynamique pouvant etreˆ ecrit´ dans tous les langages de la plateforme .Net (C#, VB.Net...) H & H: Research and Training 8 / 218 Introduction Dates de sorties de quelques versions de PHP 8 juin 1995 : Version 1.0. 1er novembre 1997 : Version 2.0. 6 juin 1998 : Version 3.0. 22 mai 2000 : Version 4.0. 10 decembre´ 2001 : Version 4.1. c 13 juillet 2004 : Version 5.0. 24 novembre 2005 : Version 5.1. 2 novembre 2006 : Version 5.2. 30 juin 2009 : Version 5.3. 1er mars 2012 : Version 5.4. 20 juin 2013 : VersionAchref 5.5. EL MOUELHI 28 aoutˆ 2014 c : Version 5.6. 3 decembre´ 2015 : Version 7.0. 1 decembre´ 2016 : Version 7.1. 30 novembre 2017 : Version 7.2. 6 decembre´ 2018 : Version 7.3. 21 novembre 2019 : Version 7.4. H & H: Research and Training 9 / 218 Introduction PHP Requˆete Serveur HTTP Web HTTP c (index.php) index.php AchrefHTML EL MOUELHI c Interpr´eteur CSS + JS R´eponse PHP Base de HTTP donn´ees Client Serveur H & H: Research and Training 10 / 218 Sous Windows, on peut les trouver dans WAMP http://www.wampserver.com/ Introduction PHP De quoi on a besoin (le minimum) ? Un editeur´ de texte (Bloc-notes, Notepad++, Sublime Text...) Un serveur web (Apache) c Un interpreteur´ du langage PHP Et probablement un systeme` de gestion de base de donnees´ (gen´ eralement´ MySQL) c Achref EL MOUELHI H & H: Research and Training 11 / 218 Introduction PHP De quoi on a besoin (le minimum) ? Un editeur´ de texte (Bloc-notes, Notepad++, Sublime Text...) Un serveur web (Apache) c Un interpreteur´ du langage PHP Et probablement un systeme` de gestion de base de donnees´ (gen´ eralement´ MySQL) c Achref EL MOUELHI Sous Windows, on peut les trouver dans WAMP http://www.wampserver.com/ H & H: Research and Training 11 / 218 Quelques el´ ements´ dans le menu de demarrage´ de WAMP localhost : page de demarrage´ de WAMP phpMyAdmin : page web permettant la gestion des bases de donnees´ MySQL Repertoire´ www : emplacement des projets PHP sur le disque dur ... Introduction PHP Premiere` utilisation de WAMP Demarrer´ WAMP Cliquer sur WAMP dans la barre de demarrage´ et choisir Redemarrer´ les services c Si l’iconeˆ de WAMP n’est pas en vert, aller verifier´ http://forum.wampserver.com/read.php?1,88043 c Achref EL MOUELHI H & H: Research and Training 12 / 218 Introduction PHP Premiere` utilisation de WAMP Demarrer´ WAMP Cliquer sur WAMP dans la barre de demarrage´ et choisir Redemarrer´ les services c Si l’iconeˆ de WAMP n’est pas en vert, aller verifier´ http://forum.wampserver.com/read.php?1,88043 Quelques el´ ements´ Achref dans le menu de EL demarrage´ MOUELHI de WAMP localhost c : page de demarrage´ de WAMP phpMyAdmin : page web permettant la gestion des bases de donnees´ MySQL Repertoire´ www : emplacement des projets PHP sur le disque dur ... H & H: Research and Training 12 / 218 Introduction PHP On peut utiliser un IDE (Environnement de developpement´ integr´ e)´ pour eviter´ d’utiliser la console et les commandes c car un IDE integre` un compilateur lance´ memeˆ pendant l’ecriture´ du code pour profiter de la coloration syntaxique, l’auto-completion,´ l’indentation c Achref automatique... EL MOUELHI pour avoir une bonne structuration du projet H & H: Research and Training 13 / 218 Introduction PHP Exemple d’IDE pour PHP Eclipse c Netbeans WebStorm PHPStorm c Achref EL MOUELHI ... H & H: Research and Training 14 / 218 Introduction PHP Eclipse, pourquoi ? c open-source simple conseille´ pour les debutants´ Achref EL MOUELHI multi-langage c : Java, C++, PHP, Cobol, C#, JavaScript... H & H: Research and Training 15 / 218 Introduction Introduction c Eclipse : tel´ echargement´ https://www.eclipse.org/downloads/download.php?file =/oomph/epp/2019-12/R/eclipse-inst-win64.exe c Achref EL MOUELHI H & H: Research and Training 16 / 218 PHP Introduction c Achref EL MOUELHI c H & H: Research and Training 17 / 218 PHP Introduction c Achref EL MOUELHI c H & H: Research and Training 17 / 218 Introduction PHP Configuration d’Eclipse Au demarrage´ d’Eclipse, choisir le repertoire´ www de wamp64c comme workspace Aller Window > Preferences, saisir encoding Verifier´ dans toutes les sections que l’encodage utilise´ est l’UTF-8 c Achref EL MOUELHI Valider en cliquant sur Apply and close H & H: Research and Training 18 / 218 Remarque Certains anciens el´ ements´ PHP pred´ efinis´ ne respectent pas ces regles.` Avant de commencer PHP Les regles` de nommage en PHP Pour les classes : Le Pascal case c Pour les methodes,´ fonctions et variables : Le snake case Pour les noms de projets : Le Kebab case c Achref EL MOUELHI H & H: Research and Training 19 / 218 Avant de commencer PHP Les regles` de nommage en PHP Pour les classes : Le Pascal case c Pour les methodes,´ fonctions et variables : Le snake case Pour les noms de projets : Le Kebab case Achref EL MOUELHI Remarque c Certains anciens el´ ements´ PHP pred´ efinis´ ne respectent pas ces regles.` H & H: Research and Training 19 / 218 Avant de commencer PHP Le code PHP Les fichiers contenant un code PHP doivent avoir l’extension c .php Un bloc de code PHP est situe´ entre les deux balises suivantes <?php ... ?> Une page c PHPAchref est une page EL HTML MOUELHI qui contient une ou plusieurs balises PHP H & H: Research and Training 20 / 218 Avant de commencer PHP Les instructions c Chaque instruction se termine par ; Il est possible d’ecrire´ plusieurs instructions sur une memeˆ ligne (mais ce n’est pas une bonne pratique) Eclipse nousAchref facilite le formatage EL MOUELHI et l’indentation du code avec le raccourci c CTRL + Shift + F H & H: Research and Training 21 / 218 Remarque Aller verifier´ dans le repertoire´ www qu’un repertoire´ premier-cours-php a et´ e´ cre´e´ Premier projet PHP PHP Comment creer´ un projet sous Eclipse ? Aller dans File > New > PHP Project Remplir le champ Project name: avec premier-cours-php c puis cliquer sur Next Cliquer sur Finish c Achref EL MOUELHI H & H: Research and Training 22 / 218 Premier projet PHP PHP Comment creer´ un projet sous Eclipse ? Aller dans File > New > PHP Project Remplir le champ Project name: avec premier-cours-php c puis cliquer sur Next Cliquer sur Finish c Achref EL MOUELHI Remarque Aller verifier´ dans le repertoire´ www qu’un repertoire´ premier-cours-php a et´ e´ cre´e´ H & H: Research and Training 22 / 218 Premier projet PHP PHP Comment creer´ un fichier PHP ? c Faire clic droit sur le projet et aller dans New > PHP File Dans File name, saisir index.php et cliquer sur Next > Choisir New simple PHP file Achref EL MOUELHI Cliquer c sur Finish H & H: Research and Training 23 / 218 Premier projet PHP PHP Remplacer le contenu d’index.php par le suivant <!DOCTYPE html> <html> <head> c <meta charset="UTF-8"> <title>Premiere` page PHP</title> </head> <body> <?php Achref EL MOUELHI echo c "Hello world"; ?> </body> </html> H & H: Research and Training 24 / 218 Premier projet PHP PHP c Comment voir le resultat´ de cette page ? Faire clic droit sur le fichier index.php Choisir Run > PHP Web Application c Achref EL MOUELHI H & H: Research and Training 25 / 218 Premier projet PHP PHP Fonctions d’affichage : echo et print utilisables avec et sans parentheses.` echo n’a pas de valeur de retour.
Recommended publications
  • Introduction to Groovy and Grails
    Introduction to Groovy and Grails Mohamed Seifeddine November 25, 2009 1 Contents 1 Foreword 5 2 Introduction to Groovy 7 3 Getting started 9 3.1 Installing Groovy . .9 3.1.1 JDK - A Prerequisite . .9 3.1.2 Installing Groovy . .9 3.2 Updating Groovy . 10 3.3 Editors for Groovy and Grails . 10 3.4 groovysh, groovyConsole & groovy . 10 4 Boolean Evaluation, Elvis Operator & the Safe Navigation Op- erator 13 4.1 Elvis Operator . 15 4.2 Safe Navigation Operator . 15 5 String & GString 19 6 Classes, Dynamic type, Methods, Closures the & Meta-Object Protocol 21 6.1 Dynamic type . 25 6.2 Closure . 29 6.2.1 Create . 29 6.2.2 Call . 30 6.2.3 Getting Information . 33 6.2.4 Method Reference Pointer . 33 6.3 More on Methods . 35 6.3.1 Optional Parantheses . 35 6.3.2 Positional Parameters . 35 6.3.3 Optional Parameters . 36 6.3.4 Mapped Parameters . 37 6.3.5 Dynamic Method Call . 37 6.4 Meta-Object Protocol . 39 6.4.1 Adding Methods & Properties . 39 6.4.2 Add Constructor . 41 6.4.3 Intercepting Method Calls . 41 6.4.4 Getting Information . 42 7 Collections (List, Range, Map) and Iterative Object Methods 47 7.1 List . 47 7.2 Range . 50 7.3 Map . 52 8 Other 55 8.1 Groovy Switch . 55 8.2 Groovy SQL . 56 8.3 File . 58 8.4 Exception Handling . 60 2 8.5 Other . 60 9 Introduction to Grails 61 10 Getting Started 63 10.1 Installing Grails .
    [Show full text]
  • Perception and Effects of Implementing Kotlin in Existing Projects
    Bachelor thesis Undergraduate level Perception and effects of implementing Kotlin in existing projects A case study about language adoption Author: Emil Sundin Supervisor: Wei Song Examiner: Azadeh Sarkheyli Discipline: Informatics Course: IK2017 Credit: 15 credits Examination date: 2018-05-25 Dalarna University provides the opportunity for publishing the thesis through DiVA as Open Access. This means that the thesis work will become freely available to read and download through their portal. Dalarna University encourages students as well as researchers to publish their work in the Open Access format. We approve the publishing of this thesis work under the Open Access format: Yes ☒ No ☐ Dalarna University – SE-791 88 Falun – Phone +4623-77 80 00 Abstract The Kotlin programming language has seen an increase of adoption since its launch in 2011. In late 2017 Google announced first-class support for Kotlin on the Android platform which further popularized the language. With this increase in popularity we felt it was interesting to investigate how Kotlin affects the developer experience. We performed a case study to see how Java developers perceive the Kotlin language, and how it meets the requirements of these developers. To gather the developer requirements and their perception of Kotlin we performed two sets of interviews and rewrote parts of their codebase. The first set of interviews identified developer requirements and the second set of interviews showcased the Kotlin language and its potential use in their codebase. The results show that Kotlin can meet most of the developer requirements and that the perception of Kotlin is positive. Kotlin’s ability to be incrementally adopted was a prominent feature which reduced the inherent risks of technology adoption while providing them the ability to further evaluate the language.
    [Show full text]
  • Groovy and Java: a Comparison Groovy’S Resemblance to Java Is Often Quite Striking
    APPENDIX ■ ■ ■ The Groovy Language Groovy is an all-purpose programming language for the JVM. It was born in 2003 when James Strachan and Bob McWhirter founded the Groovy project with the goal of creating a glue lan- guage to easily combine existing frameworks and components. Groovy is a language that aims to bring the expressiveness of languages such as Ruby, Lisp, and Python to the Java platform while still remaining Java friendly. It attracted much excitement with these ambitious goals, because the majority of other scripting languages on the Java platform either used an entirely alien syntax and APIs or were simply Java without the need to specify types. Despite its youth, Groovy is a stable, feature-rich language that forms the perfect base for Grails. This is a fantastic achievement, given the limited resources available to an open source project such as Groovy. Groovy was an obvious choice as a platform for the Grails framework, because it provides the necessary underlying infrastructure to create the diverse range of miniature domain-specific languages utilized throughout Grails. ■Note Martin Fowler has written an excellent article about domain-specific languages: http://www.mar- tinfowler.com/bliki/DomainSpecificLanguage.html. What does this mean? Well, the syntax you see used throughout the book has often been magically enhanced and shortened by using a combination of Groovy’s already concise syntax and its support for metaprogramming. Groovy performs a lot of magic under the covers, abstracted away from the developer. This removes the burden from the programmer who would otherwise be required to write reams of unnecessary, repetitive code.
    [Show full text]
  • 451 Angular CLI, 77, 412 Component, 89 Detection, 398–399 Http Client, 320–321 Module System, 119 Deployment, 130 Ex100
    Index A AngularJS vs. Angular Angular JavaScript using JavaScript CLI, 77, 412 engines, 18 component, 89 platform, 17 detection, 398–399 semantic versioning, 16–17 Http client, 320–321 shims and polyfills, 18 module system, 119 controllers and components, 22 deployment, 130 dependency and constructor ex100, 123–126, 128–129 injection, 22–23 feature module, 122–123 forms, 24 Node commands, 131 modules, 21 root module, 121 module system, 116 routing module, 122 scope, controllers, and components, 24 shared module, 123 templates, 25 Start project, 120–121 Annotations, 91 pipes app.component.spec.ts, 412 combining date formats, 388 Application component, 89 currency, 386 Asynchronous data streams date, 386 event-based reactive programs, 291 json, 388 observable sequences, 292 lowercase, 385 observers, 292–294 percentage, 386 operators predefined date formats, 387 buffer, 300 shortdate, 386 debounce, 302–303 UK pound currency, 386 distinct, 304 uppercase, 385 filter, 304 variety of, 388, 390 from, 298 uses observables, 310 interval, 298 451 © Mark Clow 2018 M. Clow, Angular 5 Projects, https://doi.org/10.1007/978-1-4842-3279-8 INDEX Asynchronous data streams (cont.) Command line interface (CLI) map, 301 bootstrapping, 84–85 of (Was just), 299 compilation, 86 range, 299 compile errors, 82 repeat, 299 creating project, 78–79 scan, 301 file watcher and web server, 84 share, 306–307 modifying project, 81 take, 305 options, 85 timer, 300 root folder, 80 subscription, 295 runtime errors, 82 Asynchronous JavaScript and XML (AJAX) source code, 80 callbacks, 6 Component(s) encoding, 7–8 child, 159–160 HAL and HATEOAS, 8–10 class, 97 JSON and XML, 5 class life cycle promises, 6 constructor vs.
    [Show full text]
  • Less Code, More Fun
    KOTLIN LESS CODE, MORE FUN Speaker notes Michael Fazio - @faziodev + 1 Speaker notes + 2 . 1 Speaker notes I work here! 2 . 2 Speaker notes + 3 . 1 Speaker notes + 3 . 2 Speaker notes + 3 . 3 Speaker notes + 3 . 4 3 . 5 WHAT IS... Speaker notes First unveiled in 2011 (after being in dev for a year) Open-sourced in 2012 Version 1.0 released on February 15th, 2016 JetBrains said most languages were lacking the features they wanted Except Scala, but it was slow to compile JetBrains hopes to drive IntelliJ sales 4 . 1 "STATICALLY TYPED PROGRAMMING LANGUAGE FOR MODERN MULTIPLATFORM APPLICATIONS" 4 . 2 STATICALLY TYPED val numbers: List<Int> = listOf(1, 4, 7, 10, 23) enum class Sport { Baseball, Football, Soccer, Basketball } data class Team(val city: String, val teamName: String, val sport: Spo Speaker notes Staticallyval teamtyped: = Team("Milwaukee", "Brewers", Sport.Baseball) Know type of variable at compile time Java C, C++, C# Kotlin uses type inference Type system can figure the type out Don't always have to specify Will warn if not clear Modern: Concise code Lots of features 4 . 3 MULTI-PLATFORM Speaker notes First-class language on Android Interoperable with JVM Transpile Kotlin into JavaScript Compile native code (without VM) Windows Linux MacOS iOS Android WebAssembly 4 . 4 100% JAVA INTEROPERABILITY import io.reactivex.Flowable import io.reactivex.schedulers.Schedulers Flowable .fromCallable { Thread.sleep(1000) // imitate expensive computation "Done" } .subscribeOn(Schedulers.io()) .observeOn(Schedulers.single()) .subscribe(::println, Throwable::printStackTrace) Speaker notes Call existing Java libraries Use Java classes Can call Kotlin classes from Java May need a bit of tweaking 4 .
    [Show full text]
  • Groovy Basicsbasics
    GroovyGroovy BasicsBasics SangSang ShinShin JPassion.comJPassion.com ““LearnLearn withwith Passion!”Passion!” 1 Topics • What is and Why Groovy? • Groovy Syntax • Differences from Java • Refactoring Java code into Groovy code • Inter-operating with Java • Groovy Ecosystem 2 WhatWhat isis && WhyWhy Groovy?Groovy? What is Groovy? • Dynamic, objected oriented, scripting language for JVM • Seamless integration with Java > Designed with Java in mind from the beginning (unlike other scripting languages) > Easy to learn for Java programmers • Borrowed language features from Ruby, Python, Smalltalk 4 Why Groovy over Other Scripting Languages? • Groovy is a dynamic language “specifically” designed for Java platform > Leverage the benefit of JVM • Groovy provides an effortless transition from Java > Groovy code, when compiled, generated Java bytecode > Existing Java code works in Groovy environment “as it is” basis > Incremental change is possible, in fact, recommended (when you plan to migrate existing Java code to Groovy) 5 Groovy IS Java (or BETTER Java) • Provides syntactic sugar > Easy and fun to code (like Ruby) • Provides new language features over Java > Closure (Java 8 now supports closure through Lambda) > Meta-programming • Provides easier development environment > Scripting > Combines compilation and execution into a single step > Shell interpreter 6 LabLab ExerciseExercise 0:0: InstallInstall GroovyGroovy ExerciseExercise 1:1: GroovyGroovy isis JavaJava 5610_groovy_basics.zip5610_groovy_basics.zip 7 WhyWhy GroovyGroovy (or(or Scala)?Scala)?
    [Show full text]
  • Beginning Angular 2 with Typescript
    Beginning Angular 2 with Typescript Greg Lim Copyright © 2017 Greg Lim All rights reserved. COPYRIGHT © 2017 BY GREG LIM ALL RIGHTS RESERVED. NO PART OF THIS BOOK MAY BE REPRODUCED IN ANY FORM OR BY ANY ELECTRONIC OR MECHANICAL MEANS INCLUDING INFORMATION STORAGE AND RETRIEVAL SYSTEMS, WITHOUT PERMISSION IN WRITING FROM THE AUTHOR. THE ONLY EXCEPTION IS BY A REVIEWER, WHO MAY QUOTE SHORT EXCERPTS IN A REVIEW. FIRST EDITION: FEBRUARY 2017 Table of Contents PREFACE CHAPTER 1: INTRODUCTION CHAPTER 2: ANGULAR 2 QUICKSTART CHAPTER 3: RENDERING DATA AND HANDLING EVENTS CHAPTER 4: BUILDING RE-USABLE COMPONENTS CHAPTER 5: CONTROLLING RENDERING OF HTML CHAPTER 6: TEMPLATE DRIVEN FORMS CHAPTER 7: MODEL DRIVEN FORMS CHAPTER 8: INTRODUCTION TO OBSERVABLES CHAPTER 9: CONNECTING TO SERVER CHAPTER 10: BUILDING SINGLE PAGE APPS WITH ROUTING CHAPTER 11: STRUCTURING LARGE APPS WITH MODULES CHAPTER 12: C.R.U.D. WITH FIREBASE ABOUT THE AUTHOR PREFACE About this book Angular 2 is one of the leading frameworks to develop apps across all platforms. Reuse your code and build fast and high performing apps for any platform be it web, mobile web, native mobile and native desktop. You use small manageable components to build a large powerful app. No more wasting time hunting for DOM nodes! In this book, we take you on a fun, hands-on and pragmatic journey to master Angular 2 from a web development point of view. You'll start building Angular 2 apps within minutes. Every section is written in a bite-sized manner and straight to the point as I don’t want to waste your time (and most certainly mine) on the content you don't need.
    [Show full text]
  • Augmented Assignment Python String
    Augmented Assignment Python String WallacheRemington transmigrated usually demonetizing his fermatas inexorably retouch or scorings quirts dog-cheap inexhaustibly. when Precognizant edgier Connor Zebulen heightens premieres hugely alas, and discriminately.he navigates his Suety shrimp and very orthochromatic powerfully. Before writing a corpse of code, shepherded by Greg Ward, there will only small apparent for people writing C extension modules or embedding a Python interpreter and a larger application. Inside the company body, though you remedy your alternative Python implementation to be competitive. Am always missing some kid and marry reason itself are used all list the place? True those two values do these match, this fungus should have cleared up any questions you might never had after what syntax invokes which magic method. Basically, the crusade is wicked to garbage collection and will disappear from memory. Use lowercase suffix for imaginary part. If you post the attitude, but who want to pound up to speed with Python. Adds an element to fight set. We can safely ignore the results of a function. Represents a complex floating point number. The tower two pairs of expressions do for same. File copying operations, and branch of the augmented assignment operators in between. How few I clone or copy it somehow prevent this? Many programming languages have a ternary operator, someone posted an example allow this analysis is hard or perform. Allows an exile of a class to be called as a function. All sequences are cut up of elements. Place wax on the rodent line, leaving an immutable sequence type. It uses a state specific operator.
    [Show full text]
  • Groovy 2.5, 3, 4 Roadmap
    Groovy 2.5, 3, 4 Roadmap Presented by Dr Paul King © 2018, Object Computing, Inc. (OCI). All rights reserved. No part of these notes may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior, written objectcomputing.com permission of Object Computing, Inc. (OCI) Dr Paul King OCI Groovy Lead V.P. and PMC Chair Apache Groovy Author: https://www.manning.com/books/groovy-in-action-second-edition Slides: https://speakerdeck.com/paulk/groovy-roadmap Examples repo: https://github.com/paulk-asert/upcoming-groovy @paulk_asert REIMAGINE TOGETHER Grails © 2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 3 REIMAGINE TOGETHER © 2018, Object Computing, Inc. (OCI). All rights reserved. objectcomputing.com 4 Source: apache.org and apachecon.com websites Groovy Open Collective Groovy by the numbers: Downloads ❖ Popular & growing 2016: 23M 2017: 50M 2018: 103M currently: approx. 16M+ per month Groovy by the numbers: Commits ❖ Steady activity across its lifespan Groovy by the numbers: Contributors Hosting/governance: Contributors: Sponsorship: Groovy by the numbers: Issues resolved ❖ Reasonably responsive most of the time Groovy by the numbers: Releases ❖ Healthy cadence for most of its lifetime Groovy by the numbers: Enhancements ❖ On-going innovation Groovy Roadmap ❖ Groovy 2.5 ▪ 2.5.8 released ▪ Macros, AST transformation improvements, various misc. features ▪ JDK 7 minimum, runs on JDK 9/10/11 with warnings
    [Show full text]
  • Null Coalescing Operator from Wikipedia, the Free Encyclopedia
    Null coalescing operator From Wikipedia, the free encyclopedia The null coalescing operator (called the Logical Defined-Or operator in Perl, Elvis- operator in Groovy[1] and Kotlin[2]) is a binary operator that is part of the syntax for a basic conditional expression in several programming languages, including C#,[3] Perl as of version 5.10,[4] and Swift.[5] In contrast to the ternary conditional if operator used as x ? x : y, the null coalescing operator is a binary operator and thus evaluates its operands at most once, which is significant if the evaluation of x has side-effects. Contents 1 C# 2 CFML 3 Clojure 4 F# 5 Perl 6 Swift 7 SQL 8 PHP 8.1 ?: operator 8.2 ?? operator 9 Python 10 Scheme 11 JavaScript 12 Kotlin 13 Groovy 14 Objective-C 15 Haskell 16 See also 17 References C# In C#, the null coalescing operator is ??. It is most often used to simplify null expressions as follows: possiblyNullValue ?? valueIfNull For example, if one wishes to implement some C# code to give a page a default title if none is present, one may use the following statement: string pageTitle = suppliedTitle ?? "Default Title"; instead of the more verbose string pageTitle = (suppliedTitle != null) ? suppliedTitle : "Default Title"; or string pageTitle; if (suppliedTitle != null) pageTitle = suppliedTitle; else pageTitle = "Default Title"; The three forms are logically equivalent. The operator can also be used multiple times in the same expression: return some_Value ?? some_Value2 ?? some_Value3; Once a non-null value is assigned to number, or it reaches the final value (which may or may not be null), the expression is completed.
    [Show full text]
  • View the Index
    INDEX Symbols and Numbers <boost/graph/ adjacency_list.hpp>, 455 ::testin g:: , 328 adjacency_matrix.hpp>, 455 =0 (pure virtual methods), 138 edge_list.hpp>, 455 2001: A Space Odyssey, li, 353 <boost/heap/*.hpp>, 453 The 300, 685 <boost/intrusive/*.hpp> 42six, 500 associative containers, 453 <algorithm>, 576–628 sequential containers, 434 <any> , 378–379 <boost/lexical_cast.hpp>, 500 <array> , 408 <boost/logic/tribool.hpp>, 370 <atomic> , 653 <boost/math/constants/constants.hpp>, 394 std::system /bin/sh (and ), 697 <boost/multi_array.hpp>, 434 <bitset> , 432–433 <boost/multi_index_container.hpp>, 453 <boost/algorithm/ <boost/numeric/conversion/converter searching/boyer_moore.hpp> , 713 .hpp>, 401 string/case_conv.hpp> , 515 <boost/optional.hpp>, 372 string/classification.hpp> , 512, 513 <boost/pair.hpp>, 374 string/find.hpp> , 519 <boost/program_options.hpp>, 700 string/finder.hpp> , 514 <boost/property_tree/ string/join.hpp> , 517 json_parser.hpp>, 456 string/predicate.hpp> , 511 ptree.hpp>, 456 string/replace.hpp> , 515 <boost/ptr_container/*.hpp> string/split.hpp>, 517 associative containers, 453 string/trim.hpp>, 515 sequential containers, 434 <boost/any.hpp> , 378 <boost/smart_ptr/ <boost/array.hpp> , 408 intrusive_ptr.hpp>, 363 <boost/asio.hpp> , 664 shared_array.hpp>, 356 <boost/bimap.hpp> , 453 shared_ptr.hpp>, 356 <boost/chrono.hpp> , 387 <boost/test/included/unit_test.hpp>, 318 <boost/circular_buffer.hpp> , 434 <boost/timer/timer.hpp>, 390 <boost/container/ <boost/tuple/tuple.hpp>, 376 deque.hpp> , 424 <boost/unordered_map.hpp>,
    [Show full text]
  • Arxiv:1306.1870V1 [Cs.PL] 8 Jun 2013 Contents
    The Cyan Language Jos´ede Oliveira Guimar~aes Campus de Sorocaba da UFSCar Sorocaba, SP Brasil [email protected] [email protected] November 10, 2018 arXiv:1306.1870v1 [cs.PL] 8 Jun 2013 Contents 1 An Overview of Cyan 6 2 Packages and File organization 40 3 Basic Elements 44 3.1 Identifiers . 44 3.2 Comments . 44 3.3 Assignments . 45 3.4 Basic Types . 46 3.5 Operator and Selector Precedence . 53 3.6 Loops, Ifs, and other Statements . 54 3.7 Arrays . 58 4 Objects 59 4.1 Constants . 64 4.2 self . 64 4.3 clone Methods . 64 4.4 Shared Variables . 65 4.5 new, init, and initOnce Methods . 65 4.6 Order of Initialization . 69 4.7 Keyword Methods and Selectors . 70 4.8 On Names and Scope . 72 4.9 Operators as Method Names . 73 4.10 Method Overloading . 74 4.11 Inheritance . 76 4.12 Multi-Methods . 78 4.13 Any, the Super-prototype of Everybody . 79 4.14 Abstract Prototypes . 85 4.15 Interfaces . 86 4.16 Types and Subtypes . 88 4.17 Mixin Inheritance . 89 4.18 Runtime Metaobjects or Dynamic Mixins . 94 5 Metaobjects 96 5.1 Pre-defined Metaobjects . 96 5.2 Syntax and Semantics . 101 5.3 Metaobject Examples . 102 5.4 Codegs . 102 1 6 Dynamic Typing 107 7 Generic Prototypes 113 8 Important Library Objects 116 8.1 System . 116 8.2 Input and Output . 116 8.3 Tuples . 117 8.4 Dynamic Tuples . 122 8.5 Unions . 123 8.6 Intervals . 125 9 Grammar Methods 128 9.1 Matching Message Sends with Methods .
    [Show full text]