2 single: What is new in Ring 1.8?; Introduction
4 ========================
5 What is new in Ring 1.8?
6 ========================
8 In this chapter we will learn about the changes and new features in Ring 1.8 release.
11 pair: What is new in Ring 1.8?; List of changes and new features
13 List of changes and new features
14 ================================
16 Ring 1.8 comes with the next features!
19 * Find in files Application
20 * String2Constant Application
21 * StopWatch Application
23 * Compiling on Manjaro Linux
24 * Using This in the class region as Self
25 * Default value for object attributes is NULL
26 * The For Loops uses the local scope
27 * Merge binary characters
29 * Better Form Designer
32 * Better Code Generator For Extensions
33 * Better Ring Compiler and VM
34 * Notes to extensions creators
37 pair: What is new in Ring 1.8?; Better Performance
42 Ring 1.8 is faster than Ring 1.7
44 The performance gain is between 10% and 100% based on the application.
46 Check the 3D samples in this release to get an idea about the current performance.
48 For more information check the Performance Tips chapter.
51 pair: What is new in Ring 1.8?; Find in files Application
53 Find in files Application
54 =========================
56 Ring 1.8 comes with Find in files application
58 .. image:: findinfiles.png
63 pair: What is new in Ring 1.8?; String2Constant Application
65 String2Constant Application
66 ===========================
68 Ring 1.8 comes with String2Constant application
70 Using this tool we can convert the source code to be based on constants instead of string literals
72 Then we can store constants in separate source code files that we can translate to different languages
74 Where we can have special file for each language, like (English.ring, Arabic.ring and so on)
76 Using this simple tool, the Form Designer is translated to the Arabic language.
78 For more information check the Multi-language Applications chapter.
80 .. image:: string2constant.png
85 pair: What is new in Ring 1.8?; StopWatch Application
90 Ring 1.8 comes with StopWatch application
92 .. image:: stopwatch.png
96 pair: What is new in Ring 1.8?; More 3D Samples
101 Ring 1.8 comes with more 3D Samples
103 The next screen shot for the Top-Down view - Many levels of cubes sample
105 .. image:: more3dsamples.jpg
108 The next screen shot for the Camera Sample
110 .. image:: more3dsamples2.jpg
113 The next screen shot for the Camera and background sample
115 Developer : Azzeddine Remmal
117 .. image:: cameraandbackground.png
118 :alt: Camera and background
122 pair: What is new in Ring 1.8?; Compiling on Manjaro Linux
124 Compiling on Manjaro Linux
125 ==========================
127 Ring 1.8 is tested on Manjaro Linux too
131 .. image:: ringonmanjarolinux.png
132 :alt: Ring on Manjaro Linux
136 pair: What is new in Ring 1.8?; Using This in the class region as Self
138 Using This in the class region as Self
139 ======================================
141 The class region is the region that comes after the class name and before any method.
143 Now we can use This in the class region as Self.
159 this.name = "My Application"
165 ? "Version = " + version
173 Name = My Application
178 .. note:: When we use braces to change the current active object, Using This we can still point to the class.
180 .. tip:: The difference between This and Self is that Self point to the current active object that we can change using braces.
182 Remember that in most cases we don't need to use This or Self in the class region
189 class program name version
195 class program name="My Application" version="1.0"
197 .. note:: We use This or Self in the class region just to avoid conflict with global variables that are defined with the same name.
201 pair: What is new in Ring 1.8?; Default value for object attributes is NULL
203 Default value for object attributes is NULL
204 ===========================================
206 Starting from Ring 1.8 the default value for object attributes is NULL
208 In Ring, the NULL value is just an empty string or a string that contains "NULL"
210 We can check for NULL values using the isNULL() function
216 oProgram = new Program
219 ? isNULL(oProgram.name)
220 ? isNULL(oProgram.version)
221 oProgram { name="My Application" version="1.0" }
222 ? isNULL(oProgram.name)
223 ? isNULL(oProgram.version)
243 In previous versions of Ring, trying to access the object attribute before assigning a value to it
245 Will lead to runtime error and you can't check it using isnull()
247 The only way was assigning a value or using try/catch/end
249 We changed this behavior so we can have full control in seamless way.
253 pair: What is new in Ring 1.8?; The For Loops uses the local scope
255 The For Loops uses the local scope
256 ==================================
258 In Ring 1.8, when the For Loop defines new identifier (variable) it will define it in the local scope.
280 ? x # Print NULL (The "For In" loop will kill the reference after the loop)
293 pair: What is new in Ring 1.8?; Merge binary characters
295 Merge binary characters
296 =======================
298 From Ring 1.0 we can create binary strings and do operations on these strings.
300 Now in Ring 1.8, we can get individual characters from these strings and merge them together using
308 ? cstr[1] + cstr[2] + cStr[5]
309 v = cstr[1] + cstr[2] + cStr[5]
317 cStr += int2bytes(item)
322 n1 = cStr[1] + cStr[2] + cStr[3] + cStr[4]
325 n2 = cStr[5] + cStr[6] + cStr[7] + cStr[8]
328 n3 = cStr[9] + cStr[10] + cStr[11] + cStr[12]
331 cString = cStr[1] + cStr[2] + cStr[3] + cStr[4] +
332 cStr[5] + cStr[6] + cStr[7] + cStr[8] +
333 cStr[9] + cStr[10] + cStr[11] + cStr[12]
361 pair: What is new in Ring 1.8?; FoxRing Library
366 Developer: Jose Rosado
368 A class with some of the functions I used in FoxPro\
381 ? mf.frTransform(" Ring is a good language ",
382 "@! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!")
383 ? mf.frAllTrim(" Ring is a good language ", Null)
392 RING IS A GOOD LANGUAGE
393 Ring is a good language
397 pair: What is new in Ring 1.8?; Better Form Designer
402 (1) Layout Control - Display the control name when loading forms.
403 (2) Button Control - Display the button images written using relative path.
404 (3) Table Control - Display the control name when loading forms.
405 (4) Better behavior in "Bring to front" and "Send to back" operations.
406 (5) New buttons are added to the toolbar (Duplicate, Bring to front, Send to back, Delete).
407 (6) Using layouts in (Menubar designer, Window Flags window, Selecting Objects window).
408 (7) Better behavior for displaying the properties window when changing the selected objects.
409 (8) New buttons are added to move and resize multiple selection of objects.
410 (9) Window Properties - Add button to select the layout.
411 (10) Opening forms and switching between files is faster.
412 (11) Objects Order window.
413 (12) Select Objects window.
414 (13) When we change the control name, the name will be updated in layout objects.
417 pair: What is new in Ring 1.8?; Better Cards Game
422 The Cards game is updated and we can play with the Computer
424 .. image:: cardsmainmenu.png
425 :alt: Cards Main Menu
428 pair: What is new in Ring 1.8?; Better RingQt
433 * The next classes are added to RingQt
444 * RingQt for Android is updated to support modern versions of Qt
452 * In RingQt for Android, The Ring Object File (ringo) will be executed directly from resources.
456 pair: What is new in Ring 1.8?; Better Code Generator For Extensions
458 Better Code Generator For Extensions
459 ====================================
461 New Option: StaticMethods
463 Starting from Ring 1.8 the code generator support the staticmethods option.
465 So the code generator can know that the class doesn't need an object to call the methods.
478 QString displayName(QStandardPaths::StandardLocation type)
479 QString findExecutable(QString executableName, QStringList paths))
483 pair: What is new in Ring 1.8?; Better Ring Compiler and VM
485 Better Ring Compiler and VM
486 ===========================
488 (1) Better loading for files in relative paths
489 (2) Code Optimization for eval() function
490 (3) Better Memory Pool
491 (4) When embedding Ring in Ring, the error in the hosted environment will not close the host
499 pState = ring_state_init()
501 ring_state_runcode(pState," ? 'Let us try having an error' ? x")
503 ring_state_delete(pState)
513 Let us try having an error
515 Line 1 Error (R24) : Using uninitialized variable : x
516 in file Ring_EmbeddedCode
519 (5) The compiler will ignore new lines after keywords that expect tokens after it
532 #======================#
534 #======================#
539 Hello from the Test function
551 Hello from the Test function
553 (6) Better code (faster) for the main loop, special loop for eval() function.
554 (7) Better code (faster) for tracking C pointers to avoid using NULL pointers.
555 (8) Better code (faster) for getting the self object using braces.
558 pair: What is new in Ring 1.8?; Notes to extensions creators
560 Notes to extensions creators
561 ============================
563 If you have created new extensions for Ring in the C/C++ languages.
565 You have to rebuild your extension (Generate the DLL file again using Ring 1.8 header files) before usage with Ring 1.8
567 Because we changed the internal structure of the VM, but no changes to the code are required. just rebuild.