Hi,
I got an idea about code language idea and it fascinates me, so I would be happy to share it and get critics since I think it is a reasonable feature.
C was a language that promissed runtime variables allocations, as opposed to Pascal. Leading noob programmers to pit of despair. but utilizing a rather fast and absolute control over RAM. Java and C# took some hidden managment of this practice to save programmer and production from ML bugs. Those two languages also eased function definition. And this is my idea -"Inline Function Definition".
Many times I was dived in a large function full of code and I decided I need a function, precisely for the scope of the function I was in, or the class I was in. For example
public void Instructions()
{
.
.
.
string thelogiclyvarying="constblaconstblacnsta"+ id+"ocnstbla"+onto+"asfloaksf"+wouldlike+"constbla"; /* those variables on right side do not exist and exist and vary in cycle */
//so I would do
public string Compose(string id, string onto,string wouldlike)
{
return "constblaconstblacnsta"+ id+"ocnstbla"+onto+"asfloaksf"+wouldlike+"constbla";
}
while (sqlreader.Read())
{
m_sContent+=Compose(sqlreader["odID"],sqlreader["ontorequest"],sqlreader["wouldlike"]);
}
}
You could say I could just write the line- defintion of the function, to the cycle, but I am using this string in more places of the code, plus, if you got habit of doing it, you could clear the code much, plus the coding enviroment could hide the definitions or such.
So would you want this compiler feature?
Would it lead to mess or is it against code writing culture?