Hi, I would like to know if there is any alternative option for "With" in vb.net and other basic dialects. In vb.net, assume that this is our object ;
Structure Window
Public Title As String
Public Width As Integer
Public Height As Integer
End Structure
Then we can use with like this.
With Window
.Title = "New Title"
.Width = 800
.Height = 600
End With
By using with, we don't need to use "Window." everywhere. So, this is my question.
2. If not, is it possible to create one with the help of templates ? If so, then please give me some direction. Thanks in advance
is it possible to create one with the help of templates ? If so, then please give me some direction.
See if this example from the manual helps you.
All i new some pseudo code.
template `with`(value : someObject) =
if indentation is ok here, then allow user to write someObject's members with a dot sign.
allow user to write as many lines starting with a dot.
Compiler, please take the value on the right of each "=" sign in each line.
Assign that value to the left side expression.
Ha ha just joking... I dont know nothing about templates and macros. I saw a tutorial but the very first word of that tutorial article prevent me from learning it. It was NimNode. To study about macro, forst of all, i should need to mearn AST and NimNode first. I am just a hobby programmer. Fell in love with this language, but not with the ugly back side of this language.The pseudo code you have written is exactly the thing that cascade helps you to do.
The example in cascade's readme is quite straight-forward and I don't see why that would be "chinese" nor why there is a need to dismiss templates/macros (written by somebody else, in this case) because of "the ugly back side of this language" (?!).
For reading, there should be good articles which written for beginners.
Nim basics tutorial is written with beginners in mind. But it teaches only the basic concepts (which should be enough to continue the exploration on your own).
all articles about advanced subjects like macro, template etc are written by experts, for experts.
I agree that we lack "intro to macros" tutorial.
I've just started with macros, so I'm by no means expert (still lots of things I don't understand), but I plan to write a macro tutorial once I get a bit better grasp of it. And it will be aimed at (macro) beginners, to show how to make first steps in macro-land.
Feel free to explore the Examples folders, it has 1 ~ 5 lines examples, all can run by itself: https://github.com/juancarlospaco/nim-presentation-slides/tree/master/ejemplos/basico
Theres also a presentation on MD and HTML on the same repo. Examples also have an HTML index. It has English version and even cat memes :)
3. Fill the tuple in third place. If so, please point me to me there. I would like to learn it.
So if i use cascade in my project, then later if i send this library to one of my friends, what if they dont have cascade in their PC ?
The produced .exe file would work, a Nimble dependency is a compile-time dependency.
If you giving pure source code nim files, then they have Nim in their PC, to compile/run it, if they have Nim they also have Nimble, because it comes with Nim, then they have Cascade because Nimble gets it for you.
If you giving Compiled nim files, they dont need Nim nor Nimble nor Cascade nor source code files.