Sunday, March 26, 2023
Learning Code
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#
No Result
View All Result
Learning Code
No Result
View All Result
Home Swift

The future of Leaf and Tau

learningcode_x1mckf by learningcode_x1mckf
September 17, 2022
in Swift
0
The future of Leaf and Tau
74
SHARES
1.2k
VIEWS
Share on FacebookShare on Twitter


2021/01/27

Which template engine ought to I select for Vapor? What is the distinction between Leaf and Tau? Let me clarify every thing.

Vapor

Leaf

Initially, if you do not know, the Leaf 4 launch comprises some main syntactical changes in comparison with the earlier model. Curly brackets had been changed with the brand new #finish prefix syntax.


This can be a main step ahead, but additionally a breaking change, meaning it’s a must to improve your presently present Leaf 3 codebase, in any other case your templates will not work. The opposite main change is expounded to template inheritance. The brand new prolong, export and import key phrases changed the earlier embed and set key phrases, once more.

So right me if I am flawed, however this enchancment is like taking a step backward, as a result of in Leaf 2, we had kind of the identical template inheritance API capabilities (import, export, prolong, and embed). I suppose that this modification will be complicated for some individuals who had been already accustomed to the 2nd or the 3rd version of Leaf. (I used to be shocked once I noticed these adjustments.) 😐


I do not wish to criticize this resolution, however these adjustments do not vital deserve a significant model quantity. It isn’t a giant enchancment from a developer (end-user) perspective. The one factor what modified with Leaf 4.0.0 is that we builders have to vary our codebase to make issues work once more, however we have gained nearly zero new options, that I would anticipate from a significant launch.


I used to be very unhappy about this and I can think about that this will make server facet Swift builders fairly upset. I’ve already missed various options from Leaf, that I would anticipate from a contemporary template engine. Simply check out mustache or handlebars, they’re in fact older, nevertheless it’s value to say that they’ve some far more superior options, that you simply nonetheless cannot do in Leaf. 😒


Now, in the midst of the 4.0.0 improvement an attention-grabbing factor occurred with Leaf…



Tau

There was a brand new department known as Tau (means rebirth) created and maintained by @tdotclare. I jumped the practice and began to make use of this experimental department as a substitute of the primary / dev.

We additionally began to speak rather a lot with tdotclare, since there have been some points, particularly at first, however lastly I’ve discovered somebody on Vapor’s discord who I may ask about Leaf. He helped me quite a bit and I am extraordinarily grateful, as a result of with out him, the template layer of Feather CMS would not be such a tremendous (modular, reusable, extensible) system. πŸ™

Lengthy story quick, tdotclare carried out numerous great new features for Leaf Tau, the entire system began to appear like as an actual template engine, not simply one thing that you can use to switch key-based variables in a really lengthy output string. (Pardon me, however that is the case with Leaf.) πŸ™ˆ

We had a imaginative and prescient about the way forward for Tau, the place you can differentiate sorts, create new language parts and particular extensions (capabilities, strategies, blocks, contexts) for the duty it’s essential clear up, in a protected and simple method. Tau already has all these goodies and much more.

You may outline variables and constants, and the brand new template hierarchy system appears to be extra logical and future proof than every other earlier variants of the template inheritance APIs. Lastly, after numerous hours of conversations, feedbacks, testing, and bug squashing, the Tau options had been merged to the primary department and launched underneath the 4.0.0-tau.1 tag.


If you wish to preserve utilizing Tau, you need to pin your Swift dependency variations to:
.bundle(url: "https://github.com/vapor/leaf", .precise("4.0.0-tau.1")),
.bundle(url: "https://github.com/vapor/leaf-kit", .precise("1.0.0-tau.1.1")),

Sadly, the Vapor core staff determined to revert these changes shortly after the Tau launch and not using a detailed rationalization. So far as I do know the primary motive was that the core staff needs to maintain Leaf as a “easy” template engine. Do not get me flawed, I am tremendous with that call, however then it was undoubtedly a mistake to formally launch Tau and shortly after take away it identical to that. πŸ˜•




The longer term

So this is what I used to be enthusiastic about this whole matter in the previous couple of months.

Leaf 4.x

I’ve all the time felt like these new Tau options are method too good to easily drop them, simply to go along with Leaf. Plus what does the time period “easy” means? Can I anticipate something new in Leaf or is it going to be solely bug fixes solely any more? Is the long run brilliant for Leaf or ought to I merely drop it? πŸ’§

Effectively, sure. I am not going to make use of Leaf once more.

In case you are planning to construct a brand new mission and also you want a dependable, quick, dynamic template engine with a simply very primary (restricted) function set, then you need to think about using Leaf. πŸƒ


Area Particular Languages

These days everyone seems to be into DSL’s (SwiftUI), so why not use a DSL library, resembling HTMLKit or Plot as a substitute of Leaf? If the template engine will not permit me to do extra sooner or later then a DSL can be a method more sensible choice. It could possibly be extra protected and performant, however in fact we would sacrifice the dynamic nature (you all the time must recompile the complete server code after one thing adjustments), however nonetheless, based mostly on the circumstances, I can solely consider this resolution as a greater different.

If you happen to do not wish to dynamically replace templates and also you’re tremendous with the “static web site generator” strategy, then I would recommend to make use of a Area Particular Language based mostly template engine.


Tau

It’s a dynamic template engine with a really wealthy function set, that you should use to construct extra advanced templates. Since Tau is derived from Leaf it implies that the syntax may be very related, so the official Leaf documentation covers just about every thing that it’s a must to find out about it, plus I have already got some good tutorials on my web site about using the new features of Tau.

Primarily based on my expertise, I’ll stick to “Tau”.

You need to know, that the 4.0.0-tau.1 launch underneath the vapor/leaf repository may be very steady, so you should use that tag for now if you wish to give an opportunity to Tau.

It’s value to say that Tau will likely be re-released afterward in a separate repository underneath a model new identify. Sadly, I am unable to give a precise schedule for the transition course of simply but. Hopefully this manner we are able to keep away from additional confusions and builders can choose the precise software for the job.

The Vapor core staff and the authors of Leaf are doing a tremendous job. This submit just isn’t meant to hurt them in any method, however I simply wished to supply some actual rationalization for everybody who was asking me in regards to the present standing of Leaf and Tau. Thanks for understanding this. πŸ™




Source link

You might also like

Introducing – AI Utils for macOS

Encoding and decoding data using the Hummingbird framework

Hummingbird routing and requests – The.Swift.Dev.

Share30Tweet19
learningcode_x1mckf

learningcode_x1mckf

Recommended For You

Introducing – AI Utils for macOS

by learningcode_x1mckf
March 24, 2023
0
Introducing – AI Utils for macOS

⚠️ REQUIRES a FREE OpenAI API key. You will get one utilizing this hyperlink. ⚠️ Improve your productiveness with our AI powered utility application. - accessible...

Read more

Encoding and decoding data using the Hummingbird framework

by learningcode_x1mckf
March 22, 2023
0
Encoding and decoding data using the Hummingbird framework

HTTP is all about sending and receiving information over the community. Initially it was solely utilized to switch HTML paperwork, however these days we use HTTP to switch...

Read more

Hummingbird routing and requests – The.Swift.Dev.

by learningcode_x1mckf
March 17, 2023
0
Hummingbird routing and requests – The.Swift.Dev.

Routing on the server facet means the server goes to ship a response primarily based on the URL path that the consumer referred to as when firing up...

Read more

Building a Scrollable Custom Tab Bar in SwiftUI

by learningcode_x1mckf
March 10, 2023
0
Building a Scrollable Custom Tab Bar in SwiftUI

Whether or not you’re making a social media app or a productiveness device, the tab bar interface can improve the consumer expertise by making it extra intuitive and...

Read more

Beginner’s guide to server-side Swift using the Hummingbird framework

by learningcode_x1mckf
March 8, 2023
0
Beginner’s guide to server-side Swift using the Hummingbird framework

Swift on the Server in 2023 Three years in the past I began to focus on Vapor, the preferred web-framework written in Swift, which served me very...

Read more
Next Post
An Intro to Algorithms and Data Structures (Javascript Edition)

An Intro to Algorithms and Data Structures (Javascript Edition)

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Related News

Google expands open source bounties, will soon support Javascript fuzzing too – ZDNet

How to Update Object Key Values Using Javascript – hackernoon.com

March 4, 2023
Python / Java Developer (With AWS) LWJP

Python / Java Developer (With AWS) LWJP

January 28, 2023
Time limit for notify – JavaScript – SitePoint Forums

Is it possible to convert this piece of jquery code to javascript? – JavaScript – SitePoint Forums

October 27, 2022

Browse by Category

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

RECENT POSTS

  • 2023 Java roadmap for developers – TheServerSide.com
  • YS Jagan launches Ragi Java in Jagananna Gorumudda, says focused on intellectual development of students – The Hans India
  • Disadvantages of Java – TheServerSide.com

CATEGORIES

  • C#
  • C++
  • Java
  • JavaScript
  • Python
  • Swift

Β© 2022 Copyright Learning Code

No Result
View All Result
  • Home
  • JavaScript
  • Java
  • Python
  • Swift
  • C++
  • C#

Β© 2022 Copyright Learning Code

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?