New programming language automatically coordinates interactions between web page components
Besides making web applications easier to write, Ur / Web also makes them more secure. “Let’s say you want to have a calendar widget on your webpage, and you are going to use a library that provides the calendar widget, and on the same page there is also an advertisement box based on the code provided by the ad network, ”says Chlipala. “What you don’t want is for the ad network to be able to alter how the calendar works, or for the author of the calendar code to be able to interfere with the serving of the ads.” Ur / Web automatically prohibits this type of unauthorized access between the elements of the page.
Ur / Web’s ability to provide security protection and coordinate disparate web technologies stems from two properties that it shares with most full-fledged programming languages, like C ++ or Java. One is that it is “strongly typed”. This means that any new variable defined by a programmer in Ur / Web is limited to a particular data type. Likewise, any specification of a new function must include the type of data on which the function acts and the type of data it returns.
When calculating the value to return, the function may need to create new variables. (A function that returns an average of values in a database, for example, should first calculate their sum.) But these variables are inaccessible to the rest of the program. This is the second property, known as “variable scope” because it limits the scope – the extent of accessibility – of variables defined in functions.
“You might want to write a library that contains inside as private state the database table that stores usernames and passwords,” says Chlipala. “You don’t want another part of your application to be able to just read and override passwords. Most web frameworks do not support this style. They assume that every part of your program has full access to the database. “
Typing also contributes to safety. Many web development frameworks generate database queries in such a way that a person conspicuously logging into a website can type code into the username field which in effect overwrites database data. data. With Ur / Web, usernames would be their own data type, which would be treated very differently from database queries.
Often, code that is not explicitly typed still has implicit consistency rules. For example, if you write a query in the database language SQL that requests the average numeric value of a group of text fields, the database server will tell you that it cannot process your query. To enable Ur / Web to coordinate the flow of data between web technologies, Chlipala had to create libraries of new data types for SQL, XML, and Cascading Style Sheets (CSS) that embody these rules.
New programming language adapts to multiple languages in the same program
Paper: “Ur / Web: A Simple Template for Programming the Web”
Quote: New programming language automatically coordinates interactions between web page components (December 23, 2014, retrieved September 17, 2021 from https://phys.org/news/2014-12-language-automatically-interactions- web-page.html
This document is subject to copyright. Other than fair use for private study or research purposes, no part may be reproduced without written permission. The content is provided for information only.