Welcome Guest, Not a member yet? Register   Sign In
Cleaner Sintaxis
#1

[eluser]elgransan[/eluser]
The PHP sintaxis for objects is ugly (the "->" instead a ".") and in CI the "$this" everywhere dificult reading, do you know if exists any way to clean up the sintaxis?

BR!
#2

[eluser]Gerep[/eluser]
I think you can do this on your controller contructor function:

[code]$your_var = $this->the_object;[code]

and you will use your $your_var
#3

[eluser]WanWizard[/eluser]
Switch programming languages?

Or switch to a PHP framework that doesn't use objects, so you can avoid using -> ?
Or only use static classes, which allows you to use :: instead of -> ?

PHP is what it is, if you want to work with it, live with it.

Or do you go to your government and say "I don't like this word in our language, I want you to change it to this other word, it is not so ugly"?
#4

[eluser]WanWizard[/eluser]
@Gerep,

It is still an object, so you access any of it's properties or methods, you'll have to use ... guess what ... -> !
#5

[eluser]Gerep[/eluser]
Yeah...I know that but I was try to minimize his '$this' hehehe

But your answer is the best solution =)
#6

[eluser]WanWizard[/eluser]
Should have used $that in your example... :lol:
#7

[eluser]elgransan[/eluser]
everything you said is true, but I like the controversial Smile
...and thought maybe someone came up with a brilliant idea about $this Smile
#8

[eluser]Dan Horrigan[/eluser]
You have GOT to be kidding me. You come here and complain about PHP language constructs? It is people like you that gives PHP a bad rap for having a whole lot of people who don't know what they are doing. As Wan said: If you don't like '$this' or '->' then either switch languages, or stop complaining. Oh, and BTW, both of those "constructs" were brought from C and C++. Java also uses them, as do a host of other languages. TBH, I don't like the -> operator either, but it surely isn't going to change any time soon (as it shouldn't). You can do nothing to change this short of writing your own compiler.

Don't try to be controversial just to be controversial. That just makes people lose respect for you, and simply ignore anything you say. You signed up TODAY just to come in here and post that. Go back to the hole you crawled out of and keep writing your SQL in the middle of your output.
#9

[eluser]JoostV[/eluser]
@elgransan You are absolutely right. If anything, syntax should be pleasing to the eye. I would encourage you to try another language.

Personally, I like children programming languages the best. You can spike your code with little flowers and gummy bears. http://www.simplecodeworks.com/website.html
#10

[eluser]elgransan[/eluser]
Dan, yes I am. Please, take it as fun, if you really don't like it close the subject.

You are right it's my first post in this forum but don't get me wrong, I'm not complaing about PHP neither CI and I don't want to disrespect all of you work, I love PHP and CI but when get a large project on PHP for first time I see so many simbols that dificults reading a little, so... I "dream" for a clear sintaxis, that's all.




Theme © iAndrew 2016 - Forum software by © MyBB